[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMRc=Mcn_vGBy0h6ZmiD922JUYRuXDSPSn19Wk5RRyFrU+31Fw@mail.gmail.com>
Date: Thu, 15 Feb 2024 08:42:43 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Linus Walleij <linus.walleij@...aro.org>, Bartosz Golaszewski <brgl@...ev.pl>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Dan Carpenter <dan.carpenter@...aro.org>
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH] gpio: sysfs: fix inverted pointer logic
On Wed, Feb 14, 2024 at 9:52 AM Bartosz Golaszewski <brgl@...ev.pl> wrote:
>
> From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
>
> The logic is inverted, we want to return if the chip *IS* NULL.
>
> Fixes: d83cee3d2bb1 ("gpio: protect the pointer to gpio_chip in gpio_device with SRCU")
> Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> Closes: https://lore.kernel.org/linux-gpio/15671341-0b29-40e0-b487-0a4cdc414d8e@moroto.mountain/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> ---
> drivers/gpio/gpiolib-sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
> index 6285fa5afbb1..e4a6df2b317d 100644
> --- a/drivers/gpio/gpiolib-sysfs.c
> +++ b/drivers/gpio/gpiolib-sysfs.c
> @@ -801,7 +801,7 @@ void gpiochip_sysfs_unregister(struct gpio_device *gdev)
> guard(srcu)(&gdev->srcu);
>
> chip = rcu_dereference(gdev->chip);
> - if (chip)
> + if (!chip)
> return;
>
> /* unregister gpiod class devices owned by sysfs */
> --
> 2.40.1
>
Patch applied.
Bart
Powered by blists - more mailing lists