提交 f182174d 编写于 作者: J Jiasheng Jiang 提交者: Zheng Zengkai

rtc: wm8350: Handle error for wm8350_register_irq

stable inclusion
from stable-v5.10.111
commit 2e52a294700bec7867450e912e5bf91e3503288e
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5GL1Z

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2e52a294700bec7867450e912e5bf91e3503288e

--------------------------------

[ Upstream commit 43f0269b ]

As the potential failure of the wm8350_register_irq(),
it should be better to check it and return error if fails.
Also, it need not free 'wm_rtc->rtc' since it will be freed
automatically.

Fixes: 077eaf5b ("rtc: rtc-wm8350: add support for WM8350 RTC")
Signed-off-by: NJiasheng Jiang <jiasheng@iscas.ac.cn>
Acked-by: NCharles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: NAlexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220303085030.291793-1-jiasheng@iscas.ac.cnSigned-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 63fc4fbc
...@@ -432,14 +432,21 @@ static int wm8350_rtc_probe(struct platform_device *pdev) ...@@ -432,14 +432,21 @@ static int wm8350_rtc_probe(struct platform_device *pdev)
return ret; return ret;
} }
wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC, ret = wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC,
wm8350_rtc_update_handler, 0, wm8350_rtc_update_handler, 0,
"RTC Seconds", wm8350); "RTC Seconds", wm8350);
if (ret)
return ret;
wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_SEC); wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_SEC);
wm8350_register_irq(wm8350, WM8350_IRQ_RTC_ALM, ret = wm8350_register_irq(wm8350, WM8350_IRQ_RTC_ALM,
wm8350_rtc_alarm_handler, 0, wm8350_rtc_alarm_handler, 0,
"RTC Alarm", wm8350); "RTC Alarm", wm8350);
if (ret) {
wm8350_free_irq(wm8350, WM8350_IRQ_RTC_SEC, wm8350);
return ret;
}
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册