Re: [PATCH] iio: light: bh1780: return after write

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28/04/16 13:02, Linus Walleij wrote:
> When writing a value using direct reg access from debugfs
> we need to return and not fall through to reading the
> value, lest we'll dereference a NULL pointer.
> 
> Cc: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
This is another one I'll have to pick up when I can create a fixes branch for
post the merge window.

Poke me if I forget it.

Jonathan
> ---
>  drivers/iio/light/bh1780.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/light/bh1780.c b/drivers/iio/light/bh1780.c
> index 72b364e4aa72..f83595334ff1 100644
> --- a/drivers/iio/light/bh1780.c
> +++ b/drivers/iio/light/bh1780.c
> @@ -84,7 +84,7 @@ static int bh1780_debugfs_reg_access(struct iio_dev *indio_dev,
>  	int ret;
>  
>  	if (!readval)
> -		bh1780_write(bh1780, (u8)reg, (u8)writeval);
> +		return bh1780_write(bh1780, (u8)reg, (u8)writeval);
>  
>  	ret = bh1780_read(bh1780, (u8)reg);
>  	if (ret < 0)
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux