diff mbox series

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

Message ID 20220316122354.GA16825@kili (mailing list archive)
State Accepted
Headers show
Series iio: dac: ad3552r: fix signedness bug in ad3552r_reset() | expand

Commit Message

Dan Carpenter March 16, 2022, 12:23 p.m. UTC
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 <dan.carpenter@oracle.com>
---
 drivers/iio/dac/ad3552r.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron March 19, 2022, 6:25 p.m. UTC | #1
On Wed, 16 Mar 2022 15:23:54 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> 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 <dan.carpenter@oracle.com>
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

> ---
>  drivers/iio/dac/ad3552r.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/dac/ad3552r.c b/drivers/iio/dac/ad3552r.c
> index 97f13c0b9631..e0a93b27e0e8 100644
> --- a/drivers/iio/dac/ad3552r.c
> +++ b/drivers/iio/dac/ad3552r.c
> @@ -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);
diff mbox series

Patch

diff --git a/drivers/iio/dac/ad3552r.c b/drivers/iio/dac/ad3552r.c
index 97f13c0b9631..e0a93b27e0e8 100644
--- a/drivers/iio/dac/ad3552r.c
+++ b/drivers/iio/dac/ad3552r.c
@@ -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);