iio: frequency: adf4350: Return -ENOMEM on memory allocation failure
Subsystems (2)
PATCH 1/1 iio: frequency: adf4350: Return -ENOMEM on memory allocation failure
adf4350_parse_dt() returns NULL only when devm_kzalloc() fails. The caller should return -ENOMEM in this case, not -EINVAL.
--- drivers/iio/frequency/adf4350.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/frequency/adf4350.c +1 -1
@@ -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); }
Signature · 1 line
2.43.0
Quoted 3 lines · Antoniu Miclaus
adf4350_parse_dt()returns NULL only whendevm_kzalloc()fails. The caller should return-ENOMEMin this case, not-EINVAL.
Right, and the memory allocator dumps enough info if it happens.
...
Quoted 1 line
pdata = dev_get_platdata(&spi->dev);
Side note: Have you considered killing legacy platform data?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerQuoted 8 lines · On Wed, 11 Feb 2026 19:39:43 +0200 Andy Shevchenko <[email protected]>…
Quoted 3 lines · Antoniu Miclaus
adf4350_parse_dt()returns NULL only whendevm_kzalloc()fails. The caller should return-ENOMEMin this case, not-EINVAL.Right, and the memory allocator dumps enough info if it happens.
Reviewed-by Andy Shevchenko <[email protected]>
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
Quoted 7 lines
...
Quoted 1 line
pdata = dev_get_platdata(&spi->dev);Side note: Have you considered killing legacy platform data?