diff options
| author | Bartosz Golaszewski <[email protected]> | 2024-02-14 08:52:48 +0000 |
|---|---|---|
| committer | Bartosz Golaszewski <[email protected]> | 2024-02-15 07:40:40 +0000 |
| commit | be91c19e47d1b9bf1ebd7ec4a859a50a53e54882 (patch) | |
| tree | 4a3afcab53c3877a72740b0487b1d3ce88016bc1 /drivers/gpio/gpiolib-sysfs.c | |
| parent | gpio: don't let lockdep complain about inherently dangerous RCU usage (diff) | |
| download | kernel-be91c19e47d1b9bf1ebd7ec4a859a50a53e54882.tar.gz kernel-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 <[email protected]>
Closes: https://lore.kernel.org/linux-gpio/[email protected]/
Signed-off-by: Bartosz Golaszewski <[email protected]>
Diffstat (limited to 'drivers/gpio/gpiolib-sysfs.c')
| -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 */ |
