Skip to contentSkip to conversation

gpiolib: use gpiochip_get_desc() where applicable

PATCH In review Bartosz Golaszewski 2 participants 2 messages Feb 19, 2020 – Feb 21, 2020 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpiolib: use gpiochip_get_desc() where applicable

From: Bartosz Golaszewski <[email protected]>

Whenever retrieving a descriptor from a gpiochip: use the provided helper which checks for errors.

---
 drivers/gpio/gpiolib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpiolib.c +3 -1
index 4d0106ceeba7..5c761a738065 100644
@@ -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;
Signature · 1 line
2.25.0