[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alv4rqrrnjqw3fb5vsw5r4f6lv7ymvuatcqovt7ddxi5ich5on@aan7wybzrzru>
Date: Tue, 21 May 2024 07:11:38 +0000
From: Alvin Šipraga <ALSI@...g-olufsen.dk>
To: Markus Elfring <Markus.Elfring@....de>
CC: "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-sound@...r.kernel.org" <linux-sound@...r.kernel.org>,
"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>, LKML
<linux-kernel@...r.kernel.org>, Alvin Šipraga
<alvin@...s.dk>, Emil Abildgaard Svendsen <EMAS@...g-olufsen.dk>, Andi Shyti
<andi.shyti@...nel.org>, Bartosz Golaszewski <brgl@...ev.pl>, Conor Dooley
<conor+dt@...nel.org>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jaroslav Kysela <perex@...ex.cz>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>, Linus Walleij
<linus.walleij@...aro.org>, Mark Brown <broonie@...nel.org>, Michael
Turquette <mturquette@...libre.com>, "Rafael J. Wysocki" <rafael@...nel.org>,
Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>,
Stephen Boyd <sboyd@...nel.org>, Takashi Iwai <tiwai@...e.com>
Subject: Re: [PATCH 01/13] a2b: add A2B driver core
On Sun, May 19, 2024 at 10:38:25AM GMT, Markus Elfring wrote:
> [Some people who received this message don't often get email from markus.elfring@....de. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> …
> > +++ 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.
Right, I think it returns NULL on error. Thanks!
>
>
> …
> > + 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?
I think this is correct, per the comment to device_register():
| * NOTE: _Never_ directly free @dev after calling this function, even
| * if it returned an error! Always use put_device() to give up the
| * reference initialized in this function instead.
or?
Powered by blists - more mailing lists