summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorQiushi Wu <wu000273@umn.edu>2020-05-03 13:22:35 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-24 17:50:12 +0200
commit30bd1f36b6eb00bf9d96d83584e91b10e5f69dc4 (patch)
treec2a58cc222ef66cd5fc58ec67addfb6f6f0986c3 /drivers/rtc
parent91fce7922a756127ad2aaea6cce87a95f71f5a4c (diff)
downloadlinux-30bd1f36b6eb00bf9d96d83584e91b10e5f69dc4.tar.gz
linux-30bd1f36b6eb00bf9d96d83584e91b10e5f69dc4.tar.bz2
linux-30bd1f36b6eb00bf9d96d83584e91b10e5f69dc4.zip
rtc: mc13xxx: fix a double-unlock issue
[ Upstream commit 8816cd726a4fee197af2d851cbe25991ae19ea14 ] In function mc13xxx_rtc_probe, the mc13xxx_unlock() is called before rtc_register_device(). But in the error path of rtc_register_device(), the mc13xxx_unlock() is called again, which causes a double-unlock problem. Thus add a call of the function “mc13xxx_lock” in an if branch for the completion of the exception handling. Fixes: e4ae7023e182a ("rtc: mc13xxx: set range") Signed-off-by: Qiushi Wu <wu000273@umn.edu> Link: https://lore.kernel.org/r/20200503182235.1652-1-wu000273@umn.edu Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-mc13xxx.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c
index afce2c0b4bd6..d6802e6191cb 100644
--- a/drivers/rtc/rtc-mc13xxx.c
+++ b/drivers/rtc/rtc-mc13xxx.c
@@ -308,8 +308,10 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev)
mc13xxx_unlock(mc13xxx);
ret = rtc_register_device(priv->rtc);
- if (ret)
+ if (ret) {
+ mc13xxx_lock(mc13xxx);
goto err_irq_request;
+ }
return 0;