linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] rtc: rv8803: fix missing unlock on error in rv8803_set_time()
@ 2022-06-27  7:35 Yang Yingliang
  2022-06-27  7:37 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2022-06-27  7:35 UTC (permalink / raw)
  To: linux-kernel, linux-rtc; +Cc: alexandre.belloni, a.zummo, s.hauer, a.fatoum

Add the missing unlock before return from function rv8803_set_time()
in the error handling case.

Fixes: c27fee16fab1 ("rtc: rv8803: re-initialize all Epson RX8803 registers on voltage loss")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.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.25.1


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

* Re: [PATCH -next] rtc: rv8803: fix missing unlock on error in rv8803_set_time()
  2022-06-27  7:35 [PATCH -next] rtc: rv8803: fix missing unlock on error in rv8803_set_time() Yang Yingliang
@ 2022-06-27  7:37 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2022-06-27  7:37 UTC (permalink / raw)
  To: Yang Yingliang
  Cc: linux-kernel, linux-rtc, alexandre.belloni, a.zummo, a.fatoum

On Mon, Jun 27, 2022 at 03:35:49PM +0800, Yang Yingliang wrote:
> Add the missing unlock before return from function rv8803_set_time()
> in the error handling case.
> 
> Fixes: c27fee16fab1 ("rtc: rv8803: re-initialize all Epson RX8803 registers on voltage loss")

That's not the commit breaking it. Should be:

Fixes: f8176e0bb83ff ("rtc: rv8803: initialize registers on post-probe voltage loss")

With that fixed:

Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>

Sascha

> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.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.25.1
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-27  7:35 [PATCH -next] rtc: rv8803: fix missing unlock on error in rv8803_set_time() Yang Yingliang
2022-06-27  7:37 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).