Skip to contentSkip to conversation

iio: dac: ad3552r: fix signedness bug in ad3552r_reset()

PATCH Applied Dan Carpenter 2 participants 2 messages Mar 16, 2022 – Mar 19, 2022

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

PATCH 1/1 iio: dac: ad3552r: fix signedness bug in ad3552r_reset()

The "val" variable is used to store either negative error codes from ad3552r_read_reg_wrapper() or positive u16 values on success. It needs to be signed for the error handling to work correctly.

Fixes 8f2b54824b28 ("drivers:iio:dac: Add AD3552R driver support")
---
 drivers/iio/dac/ad3552r.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad3552r.c +1 -1
index 97f13c0b9631..e0a93b27e0e8 100644
@@ -656,7 +656,7 @@ static int ad3552r_reset(struct ad3552r_desc *dac)
 {
 	struct reg_addr_pool addr;
 	int ret;
-	u16 val;
+	int val;
 
 	dac->gpio_reset = devm_gpiod_get_optional(&dac->spi->dev, "reset",
 						  GPIOD_OUT_LOW);
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw
Quoted 6 lines · On Wed, 16 Mar 2022 15:23:54 +0300 Dan Carpenter <[email protected]>…

The "val" variable is used to store either negative error codes from ad3552r_read_reg_wrapper() or positive u16 values on success. It needs to be signed for the error handling to work correctly.

Fixes 8f2b54824b28 ("drivers:iio:dac: Add AD3552R driver support")

Applied to the fixes-togreg branch of iio.git, but I won't be pushing it out publicly until I have rebased that tree on rc1 as it may make a mess of ordering in linux-next

Thanks,

Jonathan

Quoted 17 lines
---
 drivers/iio/dac/ad3552r.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad3552r.c +1 -1
index 97f13c0b9631..e0a93b27e0e8 100644
@@ -656,7 +656,7 @@ static int ad3552r_reset(struct ad3552r_desc *dac)
 {
 	struct reg_addr_pool addr;
 	int ret;
-	u16 val;
+	int val;
 
 	dac->gpio_reset = devm_gpiod_get_optional(&dac->spi->dev, "reset",
 						  GPIOD_OUT_LOW);