Commit 3c7a47f6 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski
Browse files

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: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent f4e14d45
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;