diff mbox

rtc: verify a critical argument to rtc_update_irq() before using it

Message ID 20140303194050.78df18eb@linux.lan.towertech.it
State Accepted
Headers show

Commit Message

Alessandro Zummo March 3, 2014, 6:40 p.m. UTC
This small addition to the core simplifies code
in the drivers and makes them more robust when handling
shared IRQs.

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexander Shiyan <shc_work@mail.ru>

 drivers/rtc/interface.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox


diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 544be72..c2eff60 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -584,6 +584,9 @@  enum hrtimer_restart rtc_pie_update_irq(struct hrtimer *timer)
 void rtc_update_irq(struct rtc_device *rtc,
 		unsigned long num, unsigned long events)
+	if (unlikely(IS_ERR_OR_NULL(rtc)))
+		return;