From patchwork Fri Sep 19 10:26:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 391207 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-la0-x23d.google.com (mail-la0-x23d.google.com [IPv6:2a00:1450:4010:c03::23d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9BD9814018C for ; Fri, 19 Sep 2014 20:26:46 +1000 (EST) Received: by mail-la0-f61.google.com with SMTP id s18sf210744lam.16 for ; Fri, 19 Sep 2014 03:26:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:from:to:cc:subject:date:message-id:in-reply-to :references: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=6m94Zasqr9lNHXzT9M7n2RduFfOiOOmAQqrJbSz17OQ=; b=dDbiz0ApL/pWZrEcbN0K4fDSTByiEJvjW03ROcnFt6th8qYRVT8crjjb9grsAuvBRK W0tu/aP+NE53lIeB2TebS3767Rq5LEjaVgJswP0BHTHP0zb/7wlzdgbljcafO7ygT7Jz W60rBlKCMMiZPzdUd/VJCZxppbTt2jbCSQpppN0RpOC9sw4wpzqP4YpwQlEZ0eOMpZDi haEmm3Z+BdvusbajvnlvRDkiSDsaybAQ8OTX82F2uInP1z4tkQXHVJaQkNrKkInMH5Fy gU6E8MZ+G05H4Yy0w3bJ8aO4pMvbyq76DaF3wnze9ViyJckbHZwId8XyPAq7Adz/9H2T uGpw== X-Received: by 10.152.10.41 with SMTP id f9mr26134lab.6.1411122403330; Fri, 19 Sep 2014 03:26:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.152.18.133 with SMTP id w5ls334281lad.24.gmail; Fri, 19 Sep 2014 03:26:42 -0700 (PDT) X-Received: by 10.152.3.134 with SMTP id c6mr1828156lac.5.1411122402661; Fri, 19 Sep 2014 03:26:42 -0700 (PDT) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk. [93.93.135.160]) by gmr-mx.google.com with ESMTPS id p7si75824wiz.1.2014.09.19.03.26.42 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 19 Sep 2014 03:26:42 -0700 (PDT) Received-SPF: none (google.com: javier.martinez@collabora.co.uk does not designate permitted sender hosts) client-ip=93.93.135.160; Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: javier) with ESMTPSA id D8CFD609FB0 From: Javier Martinez Canillas To: Andrew Morton Cc: Alessandro Zummo , Doug Anderson , Krzysztof Kozlowski , rtc-linux@googlegroups.com, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Javier Martinez Canillas Subject: [rtc-linux] [PATCH v10 3/6] rtc: max77686: Fail to probe if no RTC regmap irqchip is set Date: Fri, 19 Sep 2014 12:26:14 +0200 Message-Id: <1411122377-10426-4-git-send-email-javier.martinez@collabora.co.uk> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1411122377-10426-1-git-send-email-javier.martinez@collabora.co.uk> References: <1411122377-10426-1-git-send-email-javier.martinez@collabora.co.uk> X-Original-Sender: javier.martinez@collabora.co.uk X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: javier.martinez@collabora.co.uk does not designate permitted sender hosts) smtp.mail=javier.martinez@collabora.co.uk 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: , List-Unsubscribe: , The max77686 mfd driver adds a regmap IRQ chip which creates an IRQ domain that is used to map the virtual RTC alarm1 interrupt. The RTC driver assumes that this will always be true since the PMIC IRQ is a required property according to the max77686 DT binding doc. If an "interrupts" property is not defined for a max77686 PMIC, then the mfd probe function will fail and the RTC platform driver will never be probed. But even when it is not possible to probe the rtc-max77686 driver without a regmap IRQ chip, it's better to explicitly check if the IRQ chip data is not NULL and gracefully fail instead of getting an OOPS. Reported-by: Krzysztof Kozlowski Signed-off-by: Javier Martinez Canillas Reviewed-by: Krzysztof Kozlowski --- Fixes the issue reported by Krzystof in: https://lkml.org/lkml/2014/8/8/121 drivers/rtc/rtc-max77686.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c index 7bb5433..55396bb 100644 --- a/drivers/rtc/rtc-max77686.c +++ b/drivers/rtc/rtc-max77686.c @@ -466,6 +466,12 @@ static int max77686_rtc_probe(struct platform_device *pdev) goto err_rtc; } + if (!max77686->rtc_irq_data) { + ret = -EINVAL; + dev_err(&pdev->dev, "%s: no RTC regmap IRQ chip\n", __func__); + goto err_rtc; + } + info->virq = regmap_irq_get_virq(max77686->rtc_irq_data, MAX77686_RTCIRQ_RTCA1); if (!info->virq) {