Skip to contentSkip to conversation

iio: adc: mcp3911: return proper error code on failure to allocate trigger

PATCH In review Marcus Folkesson 2 participants 2 messages Sep 27, 2022 – Oct 2, 2022

Subsystems (2)
lore
Share & tools
lore

Marcus Folkesson

author maintainer
#0 lore raw

PATCH 1/1 iio: adc: mcp3911: return proper error code on failure to allocate trigger

smatch warnings:
drivers/iio/adc/mcp3911.c:441 mcp3911_probe() warn: passing zero to 'PTR_ERR'

---
 drivers/iio/adc/mcp3911.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/mcp3911.c +1 -1
index 0d768006eabb..e55db02c534f 100644
@@ -554,7 +554,7 @@ static int mcp3911_probe(struct spi_device *spi)
 				indio_dev->name,
 				iio_device_id(indio_dev));
 		if (!adc->trig)
-			return PTR_ERR(adc->trig);
+			return -ENOMEM;
 
 		adc->trig->ops = &mcp3911_trigger_ops;
 		iio_trigger_set_drvdata(adc->trig, adc);
Signature · 1 line
2.37.1
maintainer
#1 lore raw
Quoted 6 lines · On Tue, 27 Sep 2022 11:25:37 +0200 Marcus Folkesson…

smatch warnings:
drivers/iio/adc/mcp3911.c:441 mcp3911_probe() warn: passing zero to 'PTR_ERR'

Applied, with addition of fixes tag to the fixes-togreg branch of iio.git. Slightly messy at this point in the cycle, but I can't push this out until Linus takes Greg's char-misc-next pull request as otherwise linux-next will get the content of Greg's tree via mine an potentially make a mess.

Should only matter for a few days though then I'll push my fixes-togreg branch out (which I've moved to being based on char-misc-next to allow me to apply a few patches for things only recently introduced).

Jonathan

Quoted 17 lines
---
 drivers/iio/adc/mcp3911.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/mcp3911.c +1 -1
index 0d768006eabb..e55db02c534f 100644
@@ -554,7 +554,7 @@ static int mcp3911_probe(struct spi_device *spi)
 				indio_dev->name,
 				iio_device_id(indio_dev));
 		if (!adc->trig)
-			return PTR_ERR(adc->trig);
+			return -ENOMEM;
 
 		adc->trig->ops = &mcp3911_trigger_ops;
 		iio_trigger_set_drvdata(adc->trig, adc);