diff options
author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-02-14 09:52:48 +0100 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-02-15 08:40:40 +0100 |
commit | be91c19e47d1b9bf1ebd7ec4a859a50a53e54882 (patch) | |
tree | 4a3afcab53c3877a72740b0487b1d3ce88016bc1 /drivers/gpio | |
parent | gpio: don't let lockdep complain about inherently dangerous RCU usage (diff) | |
download | linux-be91c19e47d1b9bf1ebd7ec4a859a50a53e54882.tar.xz linux-be91c19e47d1b9bf1ebd7ec4a859a50a53e54882.zip |
gpio: sysfs: fix inverted pointer logic
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@linaro.org>
Closes: https://lore.kernel.org/linux-gpio/15671341-0b29-40e0-b487-0a4cdc414d8e@moroto.mountain/
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpiolib-sysfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c index 71ba2a774197..67fc09a57f26 100644 --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c @@ -802,7 +802,7 @@ void gpiochip_sysfs_unregister(struct gpio_device *gdev) guard(srcu)(&gdev->srcu); chip = srcu_dereference(gdev->chip, &gdev->srcu); - if (chip) + if (!chip) return; /* unregister gpiod class devices owned by sysfs */ |