Re: [PATCH 1/2] iio: adc: ti-ads131m02: Drop redundant NULL check on devm_clk_get_enabled()
From: Andy Shevchenko
Date: Mon Jul 06 2026 - 04:12:12 EST
On Mon, Jul 6, 2026 at 9:55 AM Krzysztof Kozlowski
<krzysztof.kozlowski@xxxxxxxxxxxxxxxx> wrote:
> 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...
Thanks for confirming. So, I think this patch is good to go (maybe
with the updated commit message), but the stub perhaps should also be
addressed at some point somehow.
--
With Best Regards,
Andy Shevchenko