Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

gpio: cdev: Don't check struct gpio_chip in gpio_chrdev_open()

It's harmless even if: chrdev_open() and cdev_device_del() run at the
same time, and gpio_chrdev_open() gets called after the underlying GPIO
chip has gone. The subsequent file operations check the availability
of struct gpio_chip anyway.

Don't check struct gpio_chip in gpio_chrdev_open().

Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://patch.msgid.link/20260223061726.82161-6-tzungbi@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

authored by

Tzung-Bi Shih and committed by
Bartosz Golaszewski
ee68f18d cf674f1a

-6
-6
drivers/gpio/gpiolib-cdev.c
··· 2640 2640 struct gpio_chardev_data *cdev; 2641 2641 int ret = -ENOMEM; 2642 2642 2643 - guard(srcu)(&gdev->srcu); 2644 - 2645 - /* Fail on open if the backing gpiochip is gone */ 2646 - if (!rcu_access_pointer(gdev->chip)) 2647 - return -ENODEV; 2648 - 2649 2643 cdev = kzalloc(sizeof(*cdev), GFP_KERNEL); 2650 2644 if (!cdev) 2651 2645 return -ENOMEM;