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: <CAMRc=MepZEDg4=DmFu+NhbbK4dNGFgAvTuhD2SviMYESRJFnQQ@mail.gmail.com>
Date: Fri, 7 Feb 2025 09:22:00 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>, 
	Linus Walleij <linus.walleij@...aro.org>, linux-gpio@...r.kernel.org, 
	linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org, 
	Kees Cook <kees@...nel.org>, "Gustavo A. R. Silva" <gustavoars@...nel.org>
Subject: Re: [PATCH v1 5/7] gpio: 74x164: Fully convert to use managed resources

On Mon, Feb 3, 2025 at 1:18 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> Convert the driver probe stage to use managed resources.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  drivers/gpio/gpio-74x164.c | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c
> index 0f720d539fa7..920d3b9c1087 100644
> --- a/drivers/gpio/gpio-74x164.c
> +++ b/drivers/gpio/gpio-74x164.c
> @@ -95,6 +95,19 @@ static int gen_74x164_direction_output(struct gpio_chip *gc,
>         return 0;
>  }
>
> +static void gen_74x164_deactivate(void *data)
> +{
> +       struct gen_74x164_chip *chip = data;
> +
> +       gpiod_set_value_cansleep(chip->gpiod_oe, 0);
> +}
> +
> +static int gen_74x164_activate(struct device *dev, struct gen_74x164_chip *chip)
> +{
> +       gpiod_set_value_cansleep(chip->gpiod_oe, 1);
> +       return devm_add_action_or_reset(dev, gen_74x164_deactivate, chip);
> +}
> +
>  static int gen_74x164_probe(struct spi_device *spi)
>  {
>         struct device *dev = &spi->dev;
> @@ -128,8 +141,6 @@ static int gen_74x164_probe(struct spi_device *spi)
>         if (IS_ERR(chip->gpiod_oe))
>                 return PTR_ERR(chip->gpiod_oe);
>
> -       spi_set_drvdata(spi, chip);
> -
>         chip->gpio_chip.label = spi->modalias;
>         chip->gpio_chip.direction_output = gen_74x164_direction_output;
>         chip->gpio_chip.get = gen_74x164_get_value;
> @@ -149,7 +160,9 @@ static int gen_74x164_probe(struct spi_device *spi)
>         if (ret)
>                 return dev_err_probe(&spi->dev, ret, "Config write failed\n");
>
> -       gpiod_set_value_cansleep(chip->gpiod_oe, 1);
> +       ret = gen_74x164_activate(dev, chip);
> +       if (ret)
> +               return ret;
>
>         return devm_gpiochip_add_data(&spi->dev, &chip->gpio_chip, chip);
>  }
> @@ -181,7 +194,6 @@ static struct spi_driver gen_74x164_driver = {
>                 .of_match_table = gen_74x164_dt_ids,
>         },
>         .probe          = gen_74x164_probe,
> -       .remove         = gen_74x164_remove,

Did you forget to remove gen_74x164_remove()?

Bart

>         .id_table       = gen_74x164_spi_ids,
>  };
>  module_spi_driver(gen_74x164_driver);
> --
> 2.43.0.rc1.1336.g36b5255a03ac
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ