[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-kernel
Subject:    Re: [PATCH 01/13] a2b: add A2B driver core
From:       Markus Elfring <Markus.Elfring () web ! de>
Date:       2024-05-19 8:38:25
Message-ID: feb239b1-7a14-479a-87f2-dcbf9966bffd () web ! de
[Download RAW message or body]

…
> +++ b/drivers/a2b/a2b.c
> @@ -0,0 +1,1252 @@
…
> +static int a2b_bus_of_add_node(struct a2b_bus *bus, struct device_node *np,
> +			       unsigned int addr)
> +{
…
> +	node = kzalloc(sizeof(*node), GFP_KERNEL);
> +	if (IS_ERR(node))
> +		return -ENOMEM;

Please improve the distinction for checks according to the handling of error/null pointers.


…
> +	ret = device_register(&node->dev);
> +	if (ret)
> +		goto err_put_device;
> +
> +	return 0;
> +
> +err_put_device:
> +	put_device(&node->dev);
> +
> +	return ret;
> +}

Did you overlook to release the node memory after a failed function call
at such a source code place?

Regards,
Markus

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic