lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+V-a8t1NRXUhZTM+cK5v-g2EUKDz8GUpSYwXjLqpdMc3c3zNA@mail.gmail.com>
Date: Sun, 8 Dec 2024 20:58:17 +0000
From: "Lad, Prabhakar" <prabhakar.csengg@...il.com>
To: Claudiu <claudiu.beznea@...on.dev>
Cc: prabhakar.mahadev-lad.rj@...renesas.com, jic23@...nel.org, lars@...afoo.de, 
	robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org, 
	geert+renesas@...der.be, magnus.damm@...il.com, mturquette@...libre.com, 
	sboyd@...nel.org, p.zabel@...gutronix.de, linux-iio@...r.kernel.org, 
	linux-renesas-soc@...r.kernel.org, devicetree@...r.kernel.org, 
	linux-kernel@...r.kernel.org, linux-clk@...r.kernel.org, 
	Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
Subject: Re: [PATCH v2 07/15] iio: adc: rzg2l_adc: Simplify the locking scheme
 in rzg2l_adc_read_raw()

On Fri, Dec 6, 2024 at 11:15 AM Claudiu <claudiu.beznea@...on.dev> wrote:
>
> From: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
>
> Simplify the locking scheme in rzg2l_adc_read_raw() by using
> guard(mutex)().
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
> ---
>
> Changes in v2:
> - used guard(mutex)()
> - adjusted the patch description
>
>  drivers/iio/adc/rzg2l_adc.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>

Cheers,
Prabhakar

> diff --git a/drivers/iio/adc/rzg2l_adc.c b/drivers/iio/adc/rzg2l_adc.c
> index 38d4fb014847..953511191eac 100644
> --- a/drivers/iio/adc/rzg2l_adc.c
> +++ b/drivers/iio/adc/rzg2l_adc.c
> @@ -8,6 +8,7 @@
>   */
>
>  #include <linux/bitfield.h>
> +#include <linux/cleanup.h>
>  #include <linux/completion.h>
>  #include <linux/delay.h>
>  #include <linux/iio/iio.h>
> @@ -220,21 +221,21 @@ static int rzg2l_adc_read_raw(struct iio_dev *indio_dev,
>         u8 ch;
>
>         switch (mask) {
> -       case IIO_CHAN_INFO_RAW:
> +       case IIO_CHAN_INFO_RAW: {
>                 if (chan->type != IIO_VOLTAGE)
>                         return -EINVAL;
>
> -               mutex_lock(&adc->lock);
> +               guard(mutex)(&adc->lock);
> +
>                 ch = chan->channel & RZG2L_ADC_CHN_MASK;
>                 ret = rzg2l_adc_conversion(indio_dev, adc, ch);
> -               if (ret) {
> -                       mutex_unlock(&adc->lock);
> +               if (ret)
>                         return ret;
> -               }
> +
>                 *val = adc->last_val[ch];
> -               mutex_unlock(&adc->lock);
>
>                 return IIO_VAL_INT;
> +       }
>
>         default:
>                 return -EINVAL;
> --
> 2.39.2
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ