Re: [PATCH] iio: adis16475: fix deadlock on frequency set

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

 



On Mon, Sep 20, 2021 at 12:59 PM Nuno Sá <nuno.sa@xxxxxxxxxx> wrote:
>
> With commit 39c024b51b560
> ("iio: adis16475: improve sync scale mode handling"), two deadlocks were
> introduced:
>  1) The call to 'adis_write_reg_16()' was not changed to it's unlocked
>     version.
>  2) The lock was not being released on the success path of the function.
>
> This change fixes both these issues.
>

Reviewed-by: Alexandru Ardelean <ardeleanalex@xxxxxxxxx>

> Fixes: 39c024b51b560 ("iio: adis16475: improve sync scale mode handling")
> Signed-off-by: Nuno Sá <nuno.sa@xxxxxxxxxx>
> ---
>  drivers/iio/imu/adis16475.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/imu/adis16475.c b/drivers/iio/imu/adis16475.c
> index eb48102f9424..287fff39a927 100644
> --- a/drivers/iio/imu/adis16475.c
> +++ b/drivers/iio/imu/adis16475.c
> @@ -353,10 +353,11 @@ static int adis16475_set_freq(struct adis16475 *st, const u32 freq)
>         if (dec > st->info->max_dec)
>                 dec = st->info->max_dec;
>
> -       ret = adis_write_reg_16(&st->adis, ADIS16475_REG_DEC_RATE, dec);
> +       ret = __adis_write_reg_16(&st->adis, ADIS16475_REG_DEC_RATE, dec);
>         if (ret)
>                 goto error;
>
> +       adis_dev_unlock(&st->adis);
>         /*
>          * If decimation is used, then gyro and accel data will have meaningful
>          * bits on the LSB registers. This info is used on the trigger handler.
> --
> 2.33.0
>




[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