iio: dac: ad3552r: fix signedness bug in ad3552r_reset()
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")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/iio/dac/ad3552r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad3552r.c +1 -1
@@ -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
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")Signed-off-by Dan Carpenter <[email protected]>
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@@ -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 );