[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200219094702.6463-1-brgl@bgdev.pl>
Date: Wed, 19 Feb 2020 10:47:02 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: [PATCH] gpiolib: use gpiochip_get_desc() where applicable
From: Bartosz Golaszewski <bgolaszewski@...libre.com>
Whenever retrieving a descriptor from a gpiochip: use the provided
helper which checks for errors.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@...libre.com>
---
drivers/gpio/gpiolib.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 4d0106ceeba7..5c761a738065 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2953,7 +2953,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;
--
2.25.0
Powered by blists - more mailing lists