Commit be91c19e authored by Bartosz Golaszewski's avatar Bartosz Golaszewski

gpio: sysfs: fix inverted pointer logic

The logic is inverted, we want to return if the chip *IS* NULL.

Fixes: d83cee3d ("gpio: protect the pointer to gpio_chip in gpio_device with SRCU")
Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-gpio/15671341-0b29-40e0-b487-0a4cdc414d8e@moroto.mountain/Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent 0d7fa0ed
...@@ -802,7 +802,7 @@ void gpiochip_sysfs_unregister(struct gpio_device *gdev) ...@@ -802,7 +802,7 @@ void gpiochip_sysfs_unregister(struct gpio_device *gdev)
guard(srcu)(&gdev->srcu); guard(srcu)(&gdev->srcu);
chip = srcu_dereference(gdev->chip, &gdev->srcu); chip = srcu_dereference(gdev->chip, &gdev->srcu);
if (chip) if (!chip)
return; return;
/* unregister gpiod class devices owned by sysfs */ /* unregister gpiod class devices owned by sysfs */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment