gpiolib: use gpiochip_get_desc() where applicable
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Wed, 19 Feb 2020 09:47:02 +0000 (10:47 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 21 Feb 2020 14:51:32 +0000 (15:51 +0100)
Whenever retrieving a descriptor from a gpiochip: use the provided
helper which checks for errors.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Link: https://lore.kernel.org/r/20200219094702.6463-1-brgl@bgdev.pl
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c

index f73077f26effa6f8c8ff597a53d2dc28099ccdb1..611709fd560f0908e3bac3545b4825b2fa4a31e0 100644 (file)
@@ -3143,7 +3143,9 @@ const char *gpiochip_is_requested(struct gpio_chip *chip, unsigned offset)
        if (offset >= chip->ngpio)
                return NULL;
 
-       desc = &chip->gpiodev->descs[offset];
+       desc = gpiochip_get_desc(chip, offset);
+       if (IS_ERR(desc))
+               return NULL;
 
        if (test_bit(FLAG_REQUESTED, &desc->flags) == 0)
                return NULL;