From patchwork Sun Nov 19 04:52:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10065071 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 62BFE602CB for ; Sun, 19 Nov 2017 05:04:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5ACF1294CB for ; Sun, 19 Nov 2017 05:04:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E270294D0; Sun, 19 Nov 2017 05:04:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 00C26294CB for ; Sun, 19 Nov 2017 05:04:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=2be/CX5A8x1de17oRQlWKrnpKBBiWFEk5oax9eBbvDc=; b=Xgnp4JCqKW+P69xeTFP/vqlNd1 awjghjDSiPnFLRGXOPVZ+WpallUIRXugJwZ4WGEpYm0TETRSrF2meys8CMDq48GrZJb4++BIOZPzc Baj3CYyJW6EEXCoQt0TdgY2bdIA5DgK7X13j2xN5XuuPb+OnBLYUx3P4g53mwSzmAAAO4S6q+Zxwq DgiexS/jYuTF9Z7Ks1xIEtPFnJ10yKEUDRBCa/zvY7Sos5S9KnKUi5PVhTib1oQq6SJ5DVxDaa2dn CXZfG4d4+ZqEwscXNHHniE33scuGVNlSURo6oHBlK9kUlcmZJ35DahwpAx9yq+eYywn/kJYlii3ZX 3DrcPsUA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eGHmD-0006xY-4v; Sun, 19 Nov 2017 05:04:17 +0000 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eGHbg-0000Px-NR; Sun, 19 Nov 2017 04:53:28 +0000 Received: by mail-pg0-x243.google.com with SMTP id r12so4870953pgu.10; Sat, 18 Nov 2017 20:53:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=/DdhMJIHA7dPYkpTFB+tvRROKNKbmpHkIqW2MLFcS18=; b=Hkd5vgpLks2KfqRt0s3xP7ZOebu4rS2uq7zrcXMTkFc0gaDAROy6Raal9WSoHVDSQ/ ravKJ1BRZiYsLHYucj5fPQz7iSeitXfh7R8OayxoEpKMo7raHpp5MjAcos60YXVywrM6 nbM2mgMK0vo1oisWqOM5U+JLJUgja9edtggTW2N8BMYRPu9s3drESCl9NXPe38EMQt60 gvCbW73mkolazNa+XcS1OuHaC3/1nm7pcv+xGnAGygJ30outSBZW1zcaTPq5Cmun213v pS64QJ3OjBOpl3M0yOFkmQpeWaQOBHcnFTO6DHu1OO2Oj3E5YeHUPbSO+CZve6ZTcF4g f6Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=/DdhMJIHA7dPYkpTFB+tvRROKNKbmpHkIqW2MLFcS18=; b=eNJF1BV/gT0tYtvSlmYSscUAiF64CtASXupzHrfeLxmgcMimfag2nG/26Qe/cvKS4t wwDwW6rPxEGf9RH3IW0DkKyFuPuI/VDAbsr5oP/k4pwBM1EuMoaMVB9jwfSvLJMmDa0+ WDqRPrq4+9srGJ73mld2XJT58M5d7BoWhw8wNYCeFU5rsEOUBxof/4vZANVUsoBsL4RD gHYwReMfaMs7Z7YfyBZ2gbazakh65Zp8BjwimXBxFO0hmiYOVsKyIDovWBlhZKNsGtKu j2N4qeZy+MldAWvq03iXDlOxb5w0MNYftStsXvC+FKrocDlM1zkjjJjGXvHI0TP33R5P aseg== X-Gm-Message-State: AJaThX744YWXrNjnvoVdEBLWI0+Cke+eh0brZJ3gYoxyRw7z+ZA1Y23L YGePEQ/BLobgJrxHk4pGpB8iTT0q X-Google-Smtp-Source: AGs4zMao/lFwxyCsTNo9D+RcJsmyE0l4s0wO40fbwxVu4hAy1m0WyZ7hW3JhB3bqng1z7x1oL4sioQ== X-Received: by 10.98.89.220 with SMTP id k89mr7182670pfj.36.1511067188563; Sat, 18 Nov 2017 20:53:08 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id j79sm2312952pfe.129.2017.11.18.20.53.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Nov 2017 20:53:07 -0800 (PST) From: Arvind Yadav To: ben-linux@fluff.org, ulf.hansson@linaro.org, adrian.hunter@intel.com, vireshk@kernel.org, maxime.ripard@free-electrons.com, wens@csie.org, linux@armlinux.org.uk, carlo@caione.org, khilman@baylibre.com Subject: [PATCH 3/6 v3] mmc: sdhci-acpi: Handle return value of platform_get_irq Date: Sun, 19 Nov 2017 10:22:45 +0530 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171118_205325_038101_E99622C3 X-CRM114-Status: UNSURE ( 7.74 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP platform_get_irq() can fail here and we must check its return value. Signed-off-by: Arvind Yadav Acked-by: Adrian Hunter --- changes in v2 : Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid. changes in v3 : return -EINVAL instead of host->irq. drivers/mmc/host/sdhci-acpi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index b988997..0d9965b 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c @@ -566,6 +566,10 @@ static int sdhci_acpi_probe(struct platform_device *pdev) host->hw_name = "ACPI"; host->ops = &sdhci_acpi_ops_dflt; host->irq = platform_get_irq(pdev, 0); + if (host->irq <= 0) { + err = -EINVAL; + goto err_free; + } host->ioaddr = devm_ioremap_nocache(dev, iomem->start, resource_size(iomem));