public inbox for linux-rtc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: rv8803: unlock on error path in rv8803_set_time()
@ 2022-06-28  6:58 Dan Carpenter
  2022-06-28  7:05 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-06-28  6:58 UTC (permalink / raw)
  To: Alessandro Zummo, Ahmad Fatoum
  Cc: Alexandre Belloni, Sascha Hauer, linux-rtc, kernel-janitors

Call mutex_unlock(&rv8803->flags_lock) before returning if
rv8803_regs_reset() fails.

Fixes: f8176e0bb83f ("rtc: rv8803: initialize registers on post-probe voltage loss")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/rtc/rtc-rv8803.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c
index fe1247e771b9..3527a0521e9b 100644
--- a/drivers/rtc/rtc-rv8803.c
+++ b/drivers/rtc/rtc-rv8803.c
@@ -315,8 +315,10 @@ static int rv8803_set_time(struct device *dev, struct rtc_time *tm)
 
 	if (flags & RV8803_FLAG_V2F) {
 		ret = rv8803_regs_reset(rv8803);
-		if (ret)
+		if (ret) {
+			mutex_unlock(&rv8803->flags_lock);
 			return ret;
+		}
 	}
 
 	ret = rv8803_write_reg(rv8803->client, RV8803_FLAG,
-- 
2.35.1


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

end of thread, other threads:[~2022-06-28  7:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-28  6:58 [PATCH] rtc: rv8803: unlock on error path in rv8803_set_time() Dan Carpenter
2022-06-28  7:05 ` Sascha Hauer

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