Skip to contentSkip to conversation

iio: dac: fix an error code in probe()

PATCH In review Dan Carpenter 2 participants 2 messages Aug 16, 2021 – Aug 29, 2021

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

PATCH 1/1 iio: dac: fix an error code in probe()

If we have an unexpected number of channels then return -EINVAL instead of returning success.

Fixes df38a4a72a3b ("iio: dac: add TI DAC5571 family support")
---
 drivers/iio/dac/ti-dac5571.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/dac/ti-dac5571.c +1 -0
index 2a5ba1b08a1d..546a4cf6c5ef 100644
@@ -350,6 +350,7 @@ static int dac5571_probe(struct i2c_client *client,
 		data->dac5571_pwrdwn = dac5571_pwrdwn_quad;
 		break;
 	default:
+		ret = -EINVAL;
 		goto err;
 	}
 
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 5 lines · On Mon, 16 Aug 2021 21:39:54 +0300 Dan Carpenter <[email protected]>…

If we have an unexpected number of channels then return -EINVAL instead of returning success.

Fixes df38a4a72a3b ("iio: dac: add TI DAC5571 family support")

Given I'm not going to be doing another fixes pull for 5.14 (bit late afterall!) I've rebased the fixes-togreg branch to match staging/staging-next which will go in during the merge window + applied this on top.

Thanks,

Jonathan

Quoted 16 lines
---
 drivers/iio/dac/ti-dac5571.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/dac/ti-dac5571.c +1 -0
index 2a5ba1b08a1d..546a4cf6c5ef 100644
@@ -350,6 +350,7 @@ static int dac5571_probe(struct i2c_client *client,
 		data->dac5571_pwrdwn = dac5571_pwrdwn_quad;
 		break;
 	default:
+		ret = -EINVAL;
 		goto err;
 	}