Re: clk: davinci: Add NULL check in davinci_lpsc_clk_register()
From: Markus Elfring
Date: Wed Apr 02 2025 - 03:49:10 EST
>> 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.
Thanks for another bit of positive feedback.
> 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.
Such development concerns can be clarified further.
>> * 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.
The acceptance might be growing for such a software design option.
Would you like to clarify any more why the function “kzalloc” is still called here
(instead of the variant “devm_kzalloc”)?
https://elixir.bootlin.com/linux/v6.14-rc6/source/drivers/clk/davinci/psc.c#L242
Regards,
Markus