public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] gpio-pisosr: Unlock on error in pisosr_gpio_refresh()
@ 2016-02-19 21:53 Dan Carpenter
  2016-02-19 21:57 ` Andrew F. Davis
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-02-19 21:53 UTC (permalink / raw)
  To: Linus Walleij, Andrew F. Davis
  Cc: Alexandre Courbot, linux-gpio, kernel-janitors

We should unlock before returning if spi_read() fails.

Fixes: df6df93c8a73 ('gpio: Add driver for SPI serializers')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpio/gpio-pisosr.c b/drivers/gpio/gpio-pisosr.c
index 58ea08df..f9f1074 100644
--- a/drivers/gpio/gpio-pisosr.c
+++ b/drivers/gpio/gpio-pisosr.c
@@ -53,12 +53,10 @@ static int pisosr_gpio_refresh(struct pisosr_gpio *gpio)
 	}
 
 	ret = spi_read(gpio->spi, gpio->buffer, gpio->buffer_size);
-	if (ret)
-		return ret;
 
 	mutex_unlock(&gpio->lock);
 
-	return 0;
+	return ret;
 }
 
 static int pisosr_gpio_get_direction(struct gpio_chip *chip,

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

end of thread, other threads:[~2016-02-19 21:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-19 21:53 [patch] gpio-pisosr: Unlock on error in pisosr_gpio_refresh() Dan Carpenter
2016-02-19 21:57 ` Andrew F. Davis

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