Re: [PATCH v4 2/2] iio: adc: Add TI ADS131M0x ADC driver
From: Jonathan Cameron
Date: Mon Dec 08 2025 - 12:09:20 EST
On Mon, 8 Dec 2025 00:59:09 +0200
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> On Sun, Dec 07, 2025 at 07:33:13PM +0000, Jonathan Cameron wrote:
> > On Tue, 18 Nov 2025 15:18:21 +0100
> > Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> wrote:
>
> ...
>
> > > + clk = devm_clk_get_enabled(dev, NULL);
> >
> > This surprised me, so I went digging. Anyone know why
> > the stub returns NULL? Given that the normal function doesn't have
> > that as an allowed return value that seems really odd.
> >
> > Still, it does, so this code is fine if odd.
>
> I believe it has to do something with an optional clocks or so, but OTOH
> I think it's so odd that may be considered as a bug in CCF APIs.
I'd think an optional clock is optional whether or not the generic clock
stuff is built. Hence should use devm_clk_get_optional_enabled()
That one I agree should be stubbed to return NULL (which it is)
Ah well, I don't really care about the answer, just diverted me for
a few mins so I thought I'd comment.
Jonathan
>
> > > + if (IS_ERR_OR_NULL(clk)) {
> > > + if (IS_ERR(clk))
> > > + ret = PTR_ERR(clk);
> > > + else
> > > + ret = -ENODEV;
> > > +
> > > + return dev_err_probe(dev, ret, "clk get enabled failed\n");
> > > + }
>