diff mbox series

[1/2] iio: light: tsl2591: fix some signedness bugs

Message ID YJ52r1XZ44myD9Xx@mwanda (mailing list archive)
State New, archived
Headers show
Series [1/2] iio: light: tsl2591: fix some signedness bugs | expand

Commit Message

Dan Carpenter May 14, 2021, 1:10 p.m. UTC
These variables need to be int for the error handling to work.

Fixes: f053d4e748ce ("iio: light: Added AMS tsl2591 driver implementation")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/iio/light/tsl2591.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jonathan Cameron May 16, 2021, 9:30 a.m. UTC | #1
On Fri, 14 May 2021 16:10:07 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> These variables need to be int for the error handling to work.
> 
> Fixes: f053d4e748ce ("iio: light: Added AMS tsl2591 driver implementation")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Both applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to poke at it.

As such, there is still a bit of time if anyone else wants to review
these / give tags etc, before I push it out as a non rebasing branch.

thanks,

Jonathan

> ---
>  drivers/iio/light/tsl2591.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/light/tsl2591.c b/drivers/iio/light/tsl2591.c
> index 2bdae388ff01..26e3cb6c4ff8 100644
> --- a/drivers/iio/light/tsl2591.c
> +++ b/drivers/iio/light/tsl2591.c
> @@ -213,7 +213,7 @@ static int tsl2591_gain_to_multiplier(const u8 als_gain)
>  	}
>  }
>  
> -static u8 tsl2591_multiplier_to_gain(const u32 multiplier)
> +static int tsl2591_multiplier_to_gain(const u32 multiplier)
>  {
>  	switch (multiplier) {
>  	case TSL2591_CTRL_ALS_LOW_GAIN_MULTIPLIER:
> @@ -783,8 +783,8 @@ static int tsl2591_write_raw(struct iio_dev *indio_dev,
>  			     int val, int val2, long mask)
>  {
>  	struct tsl2591_chip *chip = iio_priv(indio_dev);
> -	u32 int_time;
> -	u8 gain;
> +	int int_time;
> +	int gain;
>  	int ret;
>  
>  	mutex_lock(&chip->als_mutex);
diff mbox series

Patch

diff --git a/drivers/iio/light/tsl2591.c b/drivers/iio/light/tsl2591.c
index 2bdae388ff01..26e3cb6c4ff8 100644
--- a/drivers/iio/light/tsl2591.c
+++ b/drivers/iio/light/tsl2591.c
@@ -213,7 +213,7 @@  static int tsl2591_gain_to_multiplier(const u8 als_gain)
 	}
 }
 
-static u8 tsl2591_multiplier_to_gain(const u32 multiplier)
+static int tsl2591_multiplier_to_gain(const u32 multiplier)
 {
 	switch (multiplier) {
 	case TSL2591_CTRL_ALS_LOW_GAIN_MULTIPLIER:
@@ -783,8 +783,8 @@  static int tsl2591_write_raw(struct iio_dev *indio_dev,
 			     int val, int val2, long mask)
 {
 	struct tsl2591_chip *chip = iio_priv(indio_dev);
-	u32 int_time;
-	u8 gain;
+	int int_time;
+	int gain;
 	int ret;
 
 	mutex_lock(&chip->als_mutex);