Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8654262ybn; Tue, 1 Oct 2019 11:10:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqylHPlsuuhri+TIEqlsJLfnGG4/YzCGN1LJFT4ND1HrCs+ThAJks/jolif3YEm6IR17Beqg X-Received: by 2002:aa7:dcd7:: with SMTP id w23mr26590775edu.170.1569953447134; Tue, 01 Oct 2019 11:10:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569953447; cv=none; d=google.com; s=arc-20160816; b=jVlXg4AiSv1cPyd+kgamHUBBPqaQ7lXxPeSKrC9YvRVx4UCYilDs/NI3InWowFiP3a wF9kzWsiCLTEXGKMAp8nVBGw+EUW24YygkPjT3KeEOXXlyA+5THFoPYwzGOycygDtVYj X6CFblRL8VK7KqxfiGoQ0OpCKgD2lHlLFL2hIYR8GBR2PU6cJaJTbLmaR8TN5PJ0r7dN bnxacKIyYW3zjDZsR0OPspFlQCoZH1U/0ilQZfIlB5eM5jFb3mKzZwo/UZv6rQOYTDP3 6HPX4WYRqHaZtstb/nygZtBt+5Wi1agjK95oTwuXLBydnj9DwHJnj2MNgKM+9Dsjt/E/ pC6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=JOrPYNf8kzKb9heoSMg505FaYtS5OJxEmz9r+PraVc8=; b=HWhu0AbtOakbaFemrQwEfY/9CJEcndKNcV+0KxlRheCS1QdwXPMs8VEyHIpto2c5Z7 xVdLlLxdEN7Twyq8Ez4QuYPbhfJgFcU7q80pBL4+RhhRTiavvq/QFS9/HOlS3WwN3uo6 6XjdVVUABg38MlOzS1OyuewGUAllpJK3OmXvPKAAIKRxfpRLODalxbOVpYN3lDUHM5lY b7/QoqPnxHAe6Ua+C8HqBIVNFAYmv8IyFAQO7hKO/cNKd28lZVR94Qzw4bvklKhvQMmn ECvIKn06MPr+V2LqB4VALYOs4h0uqiMo+ktPLnHC3HnT1hPgAyfnrjxxs5sSyKblMomW 0xpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i3si9241426edq.163.2019.10.01.11.10.23; Tue, 01 Oct 2019 11:10:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731218AbfJASHI (ORCPT + 99 others); Tue, 1 Oct 2019 14:07:08 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:51216 "EHLO baptiste.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729420AbfJASHH (ORCPT ); Tue, 1 Oct 2019 14:07:07 -0400 Received: from ramsan ([84.194.98.4]) by baptiste.telenet-ops.be with bizsmtp id 8J752100105gfCL01J75v0; Tue, 01 Oct 2019 20:07:05 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1iFMYD-0008Kj-1K; Tue, 01 Oct 2019 20:07:05 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1iFMYC-0000Fj-W1; Tue, 01 Oct 2019 20:07:05 +0200 From: Geert Uytterhoeven To: Ulf Hansson , Wolfram Sang Cc: Stephen Boyd , Greg Kroah-Hartman , linux-renesas-soc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] mmc: renesas_sdhi: Do not use platform_get_irq() to count interrupts Date: Tue, 1 Oct 2019 20:07:03 +0200 Message-Id: <20191001180703.910-1-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As platform_get_irq() now prints an error when the interrupt does not exist, counting interrupts by looping until failure causes the printing of scary messages like: renesas_sdhi_internal_dmac ee140000.sd: IRQ index 1 not found Fix this by using the platform_irq_count() helper to avoid touching non-existent interrupts. Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()") Signed-off-by: Geert Uytterhoeven --- This is a fix for v5.4-rc1. --- drivers/mmc/host/renesas_sdhi_core.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index d4ada5cca2d14f6a..122f429602d825bd 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -646,8 +646,8 @@ int renesas_sdhi_probe(struct platform_device *pdev, struct tmio_mmc_dma *dma_priv; struct tmio_mmc_host *host; struct renesas_sdhi *priv; + int num_irqs, irq, ret, i; struct resource *res; - int irq, ret, i; u16 ver; of_data = of_device_get_match_data(&pdev->dev); @@ -825,24 +825,26 @@ int renesas_sdhi_probe(struct platform_device *pdev, host->hs400_complete = renesas_sdhi_hs400_complete; } - i = 0; - while (1) { + /* There must be at least one IRQ source */ + num_irqs = platform_irq_count(pdev); + if (num_irqs < 1) { + ret = num_irqs; + goto eirq; + } + + for (i = 0; i < num_irqs; i++) { irq = platform_get_irq(pdev, i); - if (irq < 0) - break; - i++; + if (irq < 0) { + ret = irq; + goto eirq; + } + ret = devm_request_irq(&pdev->dev, irq, tmio_mmc_irq, 0, dev_name(&pdev->dev), host); if (ret) goto eirq; } - /* There must be at least one IRQ source */ - if (!i) { - ret = irq; - goto eirq; - } - dev_info(&pdev->dev, "%s base at 0x%08lx max clock rate %u MHz\n", mmc_hostname(host->mmc), (unsigned long) (platform_get_resource(pdev, IORESOURCE_MEM, 0)->start), -- 2.17.1