Skip to contentSkip to conversation

gpiolib: unlock on error in gpiod_set_debounce()

PATCH In review Dan Carpenter 2 participants 2 messages Sep 3, 2013 – Sep 4, 2013 1 message not in the archive GPIO

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 5225c32f.kWadywtP9mkLJ38j%[email protected]

#1 lore raw

PATCH 1/1 gpiolib: unlock on error in gpiod_set_debounce()

There is a missing unlock on error here.

drivers/gpio/gpiolib.c +2 -1
index 0eb9cba..3c01782 100644
@@ -1783,7 +1783,8 @@ static int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
 	if (!chip->set || !chip->set_debounce) {
 		pr_warn("%s: missing set() or set_debounce() operations\n",
 			__func__);
-		return -EIO;
+		status = -EIO;
+		goto fail;
 	}
 
 	status = gpio_ensure_requested(desc);
#2 lore raw
Quoted 9 lines · Dan Carpenter

There is a missing unlock on error here.

drivers/gpio/gpiolib.c +0 -0
index 0eb9cba..3c01782 100644

drivers/gpio/gpiolib.c static int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce) · line 1788

Quoted 7 lines
drivers/gpio/gpiolib.c +2 -1
@@ -1783,7 +1783,8 @@ static int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
        if (!chip->set || !chip->set_debounce) {
                pr_warn("%s: missing set() or set_debounce() operations\n",
                        __func__);
-               return -EIO;
+               status = -EIO;
+               goto fail;
        }

Yeah I screwed up. I queued another fix though, moving the locking below the check instead.

Yours,
Linus Walleij