Re: [PATCH] iio: adc: at91: call input_free_device() on allocated iio_dev

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

 



On Sat,  7 Dec 2024 13:30:45 +0900
Joe Hattori <joe@xxxxxxxxxxxxxxxxxxxxx> wrote:

> Current implementation of at91_ts_register() calls input_free_deivce()
> on st->ts_input, however, the err label can be reached before the
> allocated iio_dev is stored to st->ts_input. Thus call
> input_free_device() on input instead of st->ts_input.
> 
> Fixes: 84882b060301 ("iio: adc: at91_adc: Add support for touchscreens without TSMR")
> Signed-off-by: Joe Hattori <joe@xxxxxxxxxxxxxxxxxxxxx>
Hi Joe.

Good catch.  Longer term I'd like this driver to be fully converted to devm
managed cleanup though which would have made this bug go away.

However, having looked at it, that conversion is a rather substantial, if simple
patch, so I'm fine taking this fix and maybe someone will revisit to do that
cleanup later.

Applied and marked for stable.

thanks,

Jonathan

> ---
>  drivers/iio/adc/at91_adc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index a3f0a2321666..5927756b749a 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -979,7 +979,7 @@ static int at91_ts_register(struct iio_dev *idev,
>  	return ret;
>  
>  err:
> -	input_free_device(st->ts_input);
> +	input_free_device(input);
>  	return ret;
>  }
>  





[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