* [PATCH] iio: frequency: adf4350: Return -ENOMEM on memory allocation failure
@ 2026-02-11 17:10 Antoniu Miclaus
2026-02-11 17:39 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Antoniu Miclaus @ 2026-02-11 17:10 UTC (permalink / raw)
To: Marius Cristea, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Lars-Peter Clausen, Michael Hennerich,
linux-iio, linux-kernel
Cc: Antoniu Miclaus
adf4350_parse_dt() returns NULL only when devm_kzalloc() fails. The
caller should return -ENOMEM in this case, not -EINVAL.
Fixes: e764df679639 ("iio: frequency: adf4350: Add support for dt bindings")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/frequency/adf4350.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
index ed1741165f55..3883b63dcc3c 100644
--- a/drivers/iio/frequency/adf4350.c
+++ b/drivers/iio/frequency/adf4350.c
@@ -607,7 +607,7 @@ static int adf4350_probe(struct spi_device *spi)
if (dev_fwnode(&spi->dev)) {
pdata = adf4350_parse_dt(&spi->dev);
if (pdata == NULL)
- return -EINVAL;
+ return -ENOMEM;
} else {
pdata = dev_get_platdata(&spi->dev);
}
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] iio: frequency: adf4350: Return -ENOMEM on memory allocation failure
2026-02-11 17:10 [PATCH] iio: frequency: adf4350: Return -ENOMEM on memory allocation failure Antoniu Miclaus
@ 2026-02-11 17:39 ` Andy Shevchenko
2026-02-14 19:36 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2026-02-11 17:39 UTC (permalink / raw)
To: Antoniu Miclaus
Cc: Marius Cristea, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Lars-Peter Clausen, Michael Hennerich,
linux-iio, linux-kernel
On Wed, Feb 11, 2026 at 7:10 PM Antoniu Miclaus
<antoniu.miclaus@analog.com> wrote:
>
> adf4350_parse_dt() returns NULL only when devm_kzalloc() fails. The
> caller should return -ENOMEM in this case, not -EINVAL.
Right, and the memory allocator dumps enough info if it happens.
Reviewed-by: Andy Shevchenko <andy@kernel.org>
...
> pdata = dev_get_platdata(&spi->dev);
Side note: Have you considered killing legacy platform data?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: frequency: adf4350: Return -ENOMEM on memory allocation failure
2026-02-11 17:39 ` Andy Shevchenko
@ 2026-02-14 19:36 ` Jonathan Cameron
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2026-02-14 19:36 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Antoniu Miclaus, Marius Cristea, David Lechner, Nuno Sá,
Andy Shevchenko, Lars-Peter Clausen, Michael Hennerich,
linux-iio, linux-kernel
On Wed, 11 Feb 2026 19:39:43 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Wed, Feb 11, 2026 at 7:10 PM Antoniu Miclaus
> <antoniu.miclaus@analog.com> wrote:
> >
> > adf4350_parse_dt() returns NULL only when devm_kzalloc() fails. The
> > caller should return -ENOMEM in this case, not -EINVAL.
>
> Right, and the memory allocator dumps enough info if it happens.
> Reviewed-by: Andy Shevchenko <andy@kernel.org>
I dropped the fixes tag as seems inappropriate for something that doesn't
happen except in the death throws of a platform and where it only gave
a wrong error code. With that gone, applied.
Thanks,
Jonathan
>
> ...
>
> > pdata = dev_get_platdata(&spi->dev);
>
> Side note: Have you considered killing legacy platform data?
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-14 19:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-11 17:10 [PATCH] iio: frequency: adf4350: Return -ENOMEM on memory allocation failure Antoniu Miclaus
2026-02-11 17:39 ` Andy Shevchenko
2026-02-14 19:36 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®