Skip to contentSkip to conversation

gpio: gpiolib: Fix error path in gpiod_set_debounce()

PATCH New Fabio Estevam 1 participant 1 message Sep 3, 2013 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: gpiolib: Fix error path in gpiod_set_debounce()

From: Fabio Estevam <[email protected]>

Commit 8fea68f49 (gpio: improve error path in gpiolib) causes the following hang on a mx6qsabresd board:

ci_hdrc ci_hdrc.1: EHCI Host Controller
ci_hdrc ci_hdrc.1: new USB bus registered, assigned bus number 2 ci_hdrc ci_hdrc.1: USB 2.0 started, EHCI 1.00
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
gpiod_set_debounce: missing set() or set_debounce() operations

We should not return immediately inside the 'if' block to keep the same behaviour prior to 8fea68f49. Also, returning immediately fails to release the spinlock.

Jumping to the 'fail' label makes the boot to succeed again.

---
 drivers/gpio/gpiolib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib.c +1 -1
index 0eb9cba..cd1dd12 100644
@@ -1783,7 +1783,7 @@ 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;
+		goto fail;
 	}
 
 	status = gpio_ensure_requested(desc);
Signature · 1 line
1.8.1.2