diff options
| author | Bartosz Golaszewski <[email protected]> | 2024-02-14 08:44:18 +0000 |
|---|---|---|
| committer | Bartosz Golaszewski <[email protected]> | 2024-02-15 07:39:25 +0000 |
| commit | d82b9e0887e69d9060c854b079a3a5024788f7cb (patch) | |
| tree | 56e73a4e1f84fa9c59de78ae222fc44cef080136 /drivers/gpio/gpiolib-sysfs.c | |
| parent | gpio: cdev: use correct pointer accessors with SRCU (diff) | |
| download | kernel-d82b9e0887e69d9060c854b079a3a5024788f7cb.tar.gz kernel-d82b9e0887e69d9060c854b079a3a5024788f7cb.zip | |
gpio: use srcu_dereference() with SRCU-protected pointers
Lockdep with CONFIG_PROVE_RCU enabled reports false positives about
suspicious rcu_dereference() usage. Let's silence it by using
srcu_dereference() which is the correct helper with SRCU.
Fixes: d83cee3d2bb1 ("gpio: protect the pointer to gpio_chip in gpio_device with SRCU")
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-lkp/[email protected]
Signed-off-by: Bartosz Golaszewski <[email protected]>
Acked-by: Paul E. McKenney <[email protected]>
Diffstat (limited to 'drivers/gpio/gpiolib-sysfs.c')
| -rw-r--r-- | drivers/gpio/gpiolib-sysfs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c index 6285fa5afbb1..71ba2a774197 100644 --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c @@ -14,6 +14,7 @@ #include <linux/slab.h> #include <linux/spinlock.h> #include <linux/string.h> +#include <linux/srcu.h> #include <linux/sysfs.h> #include <linux/types.h> @@ -756,7 +757,7 @@ int gpiochip_sysfs_register(struct gpio_device *gdev) guard(srcu)(&gdev->srcu); - chip = rcu_dereference(gdev->chip); + chip = srcu_dereference(gdev->chip, &gdev->srcu); if (!chip) return -ENODEV; @@ -800,7 +801,7 @@ void gpiochip_sysfs_unregister(struct gpio_device *gdev) guard(srcu)(&gdev->srcu); - chip = rcu_dereference(gdev->chip); + chip = srcu_dereference(gdev->chip, &gdev->srcu); if (chip) return; |
