Re: [PATCH 1/2] iio: adc: ti-ads131m02: Drop redundant NULL check on devm_clk_get_enabled()
From: Krzysztof Kozlowski
Date: Mon Jul 06 2026 - 03:53:53 EST
On 06/07/2026 08:04, Andy Shevchenko wrote:
> On Mon, Jul 06, 2026 at 12:37:12AM +0100, Jonathan Cameron wrote:
>> On Sun, 5 Jul 2026 19:24:39 +0200
>> Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxxxxx> wrote:
>>
>>> devm_clk_get_enabled() does not return NULL (only valid clock or ERR
>>> pointer), so simplify the code to drop redundant IS_ERR_OR_NULL().
>>>
>>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxxxxx>
>> See the stub.
>>
>> static inline struct clk *devm_clk_get_enabled(struct device *dev,
>> const char *id)
>> {
>> return NULL;
>> }
>> Not sure what the reasoning behind that is. Maybe that
>> clock could be already on?
>>
>> We could I guess make this driver depend on one of the clk
>> related configs, but today it doesn't. So to me this NULL check smells
>> of protection we don't need so I think the change is fine, but the
>> patch description should reflect that stub and it being considered
>> reasonable to plough on regardless.
>
> Ah, good catch! I have thought for a moment about this possibility, but I gave
> tag anyway as the stub thingy should be addressed separately anyway as there
> are many drivers (I think) that do not check for NULL.
Except these ~8 cases I found (I sent a bunch of patches), no one checks
for NULL...
Best regards,
Krzysztof