Skip to contentSkip to conversation

iio: frequency: adf4350: Return -ENOMEM on memory allocation failure

PATCH In review Antoniu Miclaus 3 participants 3 messages Feb 11 – Feb 14

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

Fixes e764df679639 ("iio: frequency: adf4350: Add support for dt bindings")
---
 drivers/iio/frequency/adf4350.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/frequency/adf4350.c +1 -1
index ed1741165f55..3883b63dcc3c 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Antoniu Miclaus

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.

...

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
maintainer
#2 lore raw
Quoted 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 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.

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?