Commit 43f0269b authored by 蒋家盛's avatar 蒋家盛 Committed by Alexandre Belloni
Browse files

rtc: wm8350: Handle error for wm8350_register_irq



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: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220303085030.291793-1-jiasheng@iscas.ac.cn
parent 8a937203
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -432,14 +432,21 @@ static int wm8350_rtc_probe(struct platform_device *pdev)
		return ret;
	}

	wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC,
	ret = wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC,
			    wm8350_rtc_update_handler, 0,
			    "RTC Seconds", wm8350);
	if (ret)
		return ret;

	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,
			    "RTC Alarm", wm8350);
	if (ret) {
		wm8350_free_irq(wm8350, WM8350_IRQ_RTC_SEC, wm8350);
		return ret;
	}

	return 0;
}