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: <CAHp75VdkomLMPYZbB7-KerGmyxXxB8hQuAjLtJ0bhB5f5vfuNA@mail.gmail.com>
Date:   Thu, 19 Nov 2020 17:05:21 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Alexandru Ardelean <alexandru.ardelean@...log.com>
Cc:     "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Nandor Han <nandor.han@...com>,
        Semi Malinen <semi.malinen@...com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: Re: [PATCH] gpio: xra1403: remove unneeded spi_set_drvdata()

On Thu, Nov 19, 2020 at 4:17 PM Alexandru Ardelean
<alexandru.ardelean@...log.com> wrote:
>
> There is no matching spi_get_drvdata() call in the driver, so there is no
> need to do spi_set_drvdata(). This looks like it probably was copied from a
> driver that used both spi_set_drvdata() & spi_get_drvdata().

While above luckily (*) okay it may not always be the case.

*) it can be paired with dev_get_drvdata() which is usual for PM callbacks.

With amended commit message
Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@...log.com>
> ---
>  drivers/gpio/gpio-xra1403.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/gpio/gpio-xra1403.c b/drivers/gpio/gpio-xra1403.c
> index e2cac12092af..49c878cfd5c6 100644
> --- a/drivers/gpio/gpio-xra1403.c
> +++ b/drivers/gpio/gpio-xra1403.c
> @@ -186,15 +186,7 @@ static int xra1403_probe(struct spi_device *spi)
>                 return ret;
>         }
>
> -       ret = devm_gpiochip_add_data(&spi->dev, &xra->chip, xra);
> -       if (ret < 0) {
> -               dev_err(&spi->dev, "Unable to register gpiochip\n");
> -               return ret;
> -       }
> -
> -       spi_set_drvdata(spi, xra);
> -
> -       return 0;
> +       return devm_gpiochip_add_data(&spi->dev, &xra->chip, xra);
>  }
>
>  static const struct spi_device_id xra1403_ids[] = {
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ