linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: rtc-wm8350: Handle error for wm8350_register_irq
@ 2022-03-03  8:50 Jiasheng Jiang
  2022-03-03 13:39 ` Charles Keepax
  2022-03-08 23:31 ` Alexandre Belloni
  0 siblings, 2 replies; 3+ messages in thread
From: Jiasheng Jiang @ 2022-03-03  8:50 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni
  Cc: patches, linux-rtc, linux-kernel, Jiasheng Jiang

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: 077eaf5b40ec ("rtc: rtc-wm8350: add support for WM8350 RTC")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/rtc/rtc-wm8350.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-wm8350.c b/drivers/rtc/rtc-wm8350.c
index 2018614f258f..6eaa9321c074 100644
--- a/drivers/rtc/rtc-wm8350.c
+++ b/drivers/rtc/rtc-wm8350.c
@@ -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;
 }
-- 
2.25.1


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

* Re: [PATCH] rtc: rtc-wm8350: Handle error for wm8350_register_irq
  2022-03-03  8:50 [PATCH] rtc: rtc-wm8350: Handle error for wm8350_register_irq Jiasheng Jiang
@ 2022-03-03 13:39 ` Charles Keepax
  2022-03-08 23:31 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Charles Keepax @ 2022-03-03 13:39 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: a.zummo, alexandre.belloni, patches, linux-rtc, linux-kernel

On Thu, Mar 03, 2022 at 04:50:30PM +0800, Jiasheng Jiang wrote:
> 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: 077eaf5b40ec ("rtc: rtc-wm8350: add support for WM8350 RTC")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

* Re: [PATCH] rtc: rtc-wm8350: Handle error for wm8350_register_irq
  2022-03-03  8:50 [PATCH] rtc: rtc-wm8350: Handle error for wm8350_register_irq Jiasheng Jiang
  2022-03-03 13:39 ` Charles Keepax
@ 2022-03-08 23:31 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2022-03-08 23:31 UTC (permalink / raw)
  To: Jiasheng Jiang, a.zummo
  Cc: Alexandre Belloni, linux-kernel, linux-rtc, patches

On Thu, 3 Mar 2022 16:50:30 +0800, Jiasheng Jiang wrote:
> 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.
> 
> 

Applied, thanks!

[1/1] rtc: rtc-wm8350: Handle error for wm8350_register_irq
      commit: 5e086367298dfaa1617885e797c8a58873365f03

Best regards,
-- 
Alexandre Belloni <alexandre.belloni@bootlin.com>

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

end of thread, other threads:[~2022-03-09  1:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-03  8:50 [PATCH] rtc: rtc-wm8350: Handle error for wm8350_register_irq Jiasheng Jiang
2022-03-03 13:39 ` Charles Keepax
2022-03-08 23:31 ` Alexandre Belloni

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).