[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7513fb2c-3abe-4c29-aa94-42f0efe93396@lechnology.com>
Date: Tue, 1 Apr 2025 12:21:36 -0500
From: David Lechner <david@...hnology.com>
To: Markus Elfring <Markus.Elfring@....de>,
Henry Martin <bsdhenrymartin@...il.com>, linux-clk@...r.kernel.org
Cc: LKML <linux-kernel@...r.kernel.org>,
Michael Turquette <mturquette@...libre.com>, Stephen Boyd <sboyd@...nel.org>
Subject: Re: [PATCH] clk: davinci: Add NULL check in
davinci_lpsc_clk_register()
On 4/1/25 11:46 AM, Markus Elfring wrote:
>> devm_kasprintf() return NULL if memory allocation fails. Currently,
> …
> call? failed?
>
>
>> Add NULL check after devm_kasprintf() to prevent this issue.
>
> I propose to avoid duplicate source code also for the completion of
> the corresponding exception handling.
>
> * You may avoid repeated function calls by using another label instead.
> https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources#MEM12C.Considerusingagotochainwhenleavingafunctiononerrorwhenusingandreleasingresources-CompliantSolution(copy_process()fromLinuxkernel)
That would be OK too. I didn't worry about it in this case though
since we are only duplicating 1 very short line of code. And the
smaller diff has a better chance of successfully backporting to older
stable kernels that will also pick up this patch.
>
> * How do you think about to benefit any more from the application of the attribute “__free”?
> https://elixir.bootlin.com/linux/v6.14-rc6/source/include/linux/slab.h#L472
Not a good fit for this specific use case.
>
>
> Regards,
> Markus
Powered by blists - more mailing lists