diff options
author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-01-24 19:21:16 +0300 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-02-12 12:51:10 +0300 |
commit | 3c7a47f6c5f0d3e3c6149b7eb920f420a741e969 (patch) | |
tree | f6dbfaec964b3d7b1b4e65de86f97eba4823a52a | |
parent | f4e14d45d7fe95f6c1c136baf9e232234669dfed (diff) | |
download | linux-3c7a47f6c5f0d3e3c6149b7eb920f420a741e969.tar.xz |
gpio: cdev: don't access gdev->chip if it's not needed
The variable holding the number of GPIO lines is duplicated in GPIO
device so read it instead of unnecessarily dereferencing the chip
pointer.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-rw-r--r-- | drivers/gpio/gpiolib-cdev.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index 8e37e3befa08..e993c6a7215a 100644 --- a/drivers/gpio/gpiolib-cdev.c +++ b/drivers/gpio/gpiolib-cdev.c @@ -2701,7 +2701,7 @@ static int gpio_chrdev_open(struct inode *inode, struct file *file) if (!cdev) return -ENODEV; - cdev->watched_lines = bitmap_zalloc(gdev->chip->ngpio, GFP_KERNEL); + cdev->watched_lines = bitmap_zalloc(gdev->ngpio, GFP_KERNEL); if (!cdev->watched_lines) goto out_free_cdev; |