1
0
Fork 0

rtc: mc13xxx: fix a double-unlock issue

[ Upstream commit 8816cd726a ]

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: e4ae7023e1 ("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>
5.4-rM2-2.2.x-imx-squashed
Qiushi Wu 2020-05-03 13:22:35 -05:00 committed by Greg Kroah-Hartman
parent 91fce7922a
commit 30bd1f36b6
1 changed files with 3 additions and 1 deletions

View File

@ -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;