mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH next] gpio: viperboard: Unlock on error in vprbrd_gpiob_direction_output()
@ 2025-07-15 22:58 Dan Carpenter
  2025-07-16  9:02 ` Bartosz Golaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-07-15 22:58 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel,
	kernel-janitors

Unlock before returning if vprbrd_gpiob_setdir() fails.

Fixes: 55e2d1eec110 ("gpio: viperboard: use new GPIO line value setter callbacks")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/gpio/gpio-viperboard.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-viperboard.c b/drivers/gpio/gpio-viperboard.c
index 3eba77f981d3..e8e906b54d51 100644
--- a/drivers/gpio/gpio-viperboard.c
+++ b/drivers/gpio/gpio-viperboard.c
@@ -378,15 +378,13 @@ static int vprbrd_gpiob_direction_output(struct gpio_chip *chip,
 	gpio->gpiob_out |= (1 << offset);
 
 	mutex_lock(&vb->lock);
-
 	ret = vprbrd_gpiob_setdir(vb, offset, 1);
+	mutex_unlock(&vb->lock);
 	if (ret) {
 		dev_err(chip->parent, "usb error setting pin to output\n");
 		return ret;
 	}
 
-	mutex_unlock(&vb->lock);
-
 	return vprbrd_gpiob_set(chip, offset, value);
 }
 
-- 
2.47.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-16  9:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-15 22:58 [PATCH next] gpio: viperboard: Unlock on error in vprbrd_gpiob_direction_output() Dan Carpenter
2025-07-16  9:02 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®