From patchwork Mon Mar 3 18:40:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alessandro Zummo X-Patchwork-Id: 325972 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-pd0-x23b.google.com (mail-pd0-x23b.google.com [IPv6:2607:f8b0:400e:c02::23b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 25F002C00CE for ; Tue, 4 Mar 2014 05:40:56 +1100 (EST) Received: by mail-pd0-f187.google.com with SMTP id x10sf1074460pdj.14 for ; Mon, 03 Mar 2014 10:40:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=date:from:to:cc:subject:message-id:organization:mime-version :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe:content-type; bh=zcUQyVRF/Xb4nc1G26Jmx5JqpUOkVEfT/qOsDO2n8nM=; b=Ob47qGat5xtguxFf4JRW8IxTvdYdmweRAzoHIrNZAz7WqgPBVTybD8oscf25LP13fX oO5ZD0j93MxRWIMQGAFeXuICn4In59iU/NZ+Ab9xysqhR1tYTMilZcD6tN2qCsvBGqA2 E9pZsB+2NCT3nCVLU2DhUiq2fLadellIr5xGfilszYzYWRDc1n3eIHCw2FFJanpJxmTK 7xNxTxcWbtcZMXK1FCfRWvN+/Oho1t0I5FOyZlr4DS6Faon+d3zgCMVzv5wRetuob0xX VQ1SVeV5n+O3poxTDPr8izX4Oay6jHrwucl8DKaPL3yLz6tfujXe4UEAnSOM2QWmnAL3 2/mA== X-Received: by 10.182.117.138 with SMTP id ke10mr1117obb.42.1393872053067; Mon, 03 Mar 2014 10:40:53 -0800 (PST) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.182.155.73 with SMTP id vu9ls496238obb.21.gmail; Mon, 03 Mar 2014 10:40:52 -0800 (PST) X-Received: by 10.182.133.6 with SMTP id oy6mr14578046obb.31.1393872052549; Mon, 03 Mar 2014 10:40:52 -0800 (PST) Received: from zabrina.hetzner-de.towertech.it (zabrina.hetzner-de.towertech.it. [178.63.16.19]) by gmr-mx.google.com with ESMTP id ga1si141986qcb.0.2014.03.03.10.40.51 for ; Mon, 03 Mar 2014 10:40:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of a.zummo@towertech.it designates 178.63.16.19 as permitted sender) client-ip=178.63.16.19; Received: from linux.lan.towertech.it (93-50-192-40.ip153.fastwebnet.it [93.50.192.40]) by smtp.towertech.it (Postfix) with ESMTPSA id 3fd9Cl1H7Wzn0S; Mon, 3 Mar 2014 19:40:51 +0100 (CET) Date: Mon, 3 Mar 2014 19:40:50 +0100 From: Alessandro Zummo To: Andrew Morton Cc: Alexander Shiyan , rtc-linux@googlegroups.com, lee.jones@linaro.org, s.hauer@pengutronix.de Subject: [rtc-linux] [PATCH] rtc: verify a critical argument to rtc_update_irq() before using it Message-ID: <20140303194050.78df18eb@linux.lan.towertech.it> Organization: Tower Technologies MIME-Version: 1.0 X-Original-Sender: a.zummo@towertech.it X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of a.zummo@towertech.it designates 178.63.16.19 as permitted sender) smtp.mail=a.zummo@towertech.it Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , 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 --- drivers/rtc/interface.c | 3 +++ 1 file changed, 3 insertions(+) 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; + pm_stay_awake(rtc->dev.parent); schedule_work(&rtc->irqwork); }