Skip to contentSkip to conversation

gpiolib: Drop duplicate offset check in gpiochip_is_requested()

PATCH Applied Andy Shevchenko 3 participants 3 messages May 10, 2021 – May 21, 2021 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpiolib: Drop duplicate offset check in gpiochip_is_requested()

gpiochip_get_desc() already does the check, drop a duplicate in gpiochip_is_requested().

---
 drivers/gpio/gpiolib.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpio/gpiolib.c +0 -3
index 1427c1be749b..220a9d8dd4e3 100644
@@ -2004,9 +2004,6 @@ const char *gpiochip_is_requested(struct gpio_chip *gc, unsigned int offset)
 {
 	struct gpio_desc *desc;
 
-	if (offset >= gc->ngpio)
-		return NULL;
-
 	desc = gpiochip_get_desc(gc, offset);
 	if (IS_ERR(desc))
 		return NULL;
Signature · 1 line
2.30.2
#2 lore raw
In reply to Andy Shevchenko
Quoted 24 lines · Andy Shevchenko

gpiochip_get_desc() already does the check, drop a duplicate in gpiochip_is_requested().

---
 drivers/gpio/gpiolib.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpio/gpiolib.c +0 -4
index 1427c1be749b..220a9d8dd4e3 100644
@@ -2004,9 +2004,6 @@ const char *gpiochip_is_requested(struct gpio_chip *gc, unsigned int offset)
 {
        struct gpio_desc *desc;
 
-       if (offset >= gc->ngpio)
-               return NULL;
-
        desc = gpiochip_get_desc(gc, offset);
        if (IS_ERR(desc))
                return NULL;
--
Quoted 2 lines

2.30.2

I applied this some time ago just forgot to comment here.

Bart