From 131c9cc832162bfe45be1065fa88d1ec2c165a3d Mon Sep 17 00:00:00 2001 From: Alessandro Zummo Date: Thu, 3 Apr 2014 14:50:09 -0700 Subject: [PATCH] rtc: verify a critical argument to rtc_update_irq() before using it 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 Cc: Alexander Shiyan Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/rtc/interface.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 544be722937c..c2eff6082363 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; + pm_stay_awake(rtc->dev.parent); schedule_work(&rtc->irqwork); } -- 2.20.1