From patchwork Sun Nov 19 04:52:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10065075 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 50A3A602CB for ; Sun, 19 Nov 2017 05:04:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A847294CB for ; Sun, 19 Nov 2017 05:04:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E6AC294CD; Sun, 19 Nov 2017 05:04:31 +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 B8081294CB for ; Sun, 19 Nov 2017 05:04:30 +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=ZEpBrBTBI2s8nB0O726X0oUS6xPl71OzexUjfZ1n0Rc=; b=jgg9Y8nBj6qZcSAo3gc0wSrJ8I gaF8v0+knGMJFuaidK951HxylsUhenvz5Z8S+PhrfAjowvA/p7YZN++tIOvU9XE4WeWJoo+5FUqqZ 6fB0ZqKv3XEhZm5Q3WUS3govAMTLFIXwyZW7ZVrfyx+LRdJVkKTBI6HsoOiqZtx9+ENz6Iy4t8Uid teLmpYHIp2MzxinUEEFIYMvpjq7g4SNvG9QLLoS9sA1w/m0m3+mKwlA0RlkgpO0kLfgUoL4PnWaPj 7MgZHcfhehP9EDCl3yn0NLWN82NicDSdhZkyDsrvnfIh+K5CquMq7+PfiflIL6lGl8us85vhU4S2W toYJtBGA==; 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 1eGHmJ-00073F-Db; Sun, 19 Nov 2017 05:04:23 +0000 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eGHbm-0000Q4-5K; Sun, 19 Nov 2017 04:53:36 +0000 Received: by mail-pg0-x242.google.com with SMTP id l19so4885552pgo.2; Sat, 18 Nov 2017 20:53:13 -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=LR3SA4ooCw1GMCFGWdV7oRYAqMdOBV1i+NVAg9VHZnM=; b=l3zIMqWjeAU3wbvdLLpDALv4yggXyt1ORAGCD2Vj9WbeT17sCsLUZrTOVj8BNpvZuD /KmnWd3I9FD2Fa+rfqXr2i6WGzpodaqfMiOM0VXNXxrLYxVdrosYkLseI+AHTs2DcnTc 6KURpERQiZCOTQ+Oj8vhBsTfGBCW9r5eX0g7lzF474GHLxBa/5XeiTEjSHZlHNmh1/zt dAn0WbHBGRPHb079P7Brk4ccHp+oFOo/58BMv9oHMiiUu7q6mE3X5L2zK54vCtPtFybh TIZSfQ8BWO7C+VE+cJW8NN545YS0D5G9YdjyFsE7eZXmugDU83Rez5l/8Ru8j888JQEc Q4sA== 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=LR3SA4ooCw1GMCFGWdV7oRYAqMdOBV1i+NVAg9VHZnM=; b=rN7K34DazncCoF2eqMIfpFlkhvtL/GOTAOo620s3Ukuq6gKkRHFBFPagtmuKqJ/1ed z5Rpyl2Y+tfn7QPdDRXTktbRBVN3C0sZW9gJDtVywxlvlFNP/1X771t8XmqsmRPBe5ZX SPyl4n2TlCEMZ/owQbj1qP6p0JCzDHw1EgChxLouZnT0WnoSvFo53HkC1urdWYEjzKzQ 5VxWwnqzHNnJ+S8Bf7AZq8MJY6KrtCw4A8wP0D0ElkhFdYXRKyBSQJqlnIz1ifo0eUpY YpEs42cPInk10Mx/8Gk7SUbfazMoC+nEkFY91qYAmWizMDQyHYVwQkly1dK3nR2zRptA z8+A== X-Gm-Message-State: AJaThX4Z03jcrNbIjOgBgGZe9QebKSPpsUql9hK2hRK0zuovr/nHxYY9 e4Pl7bdpEGXweTMpEs84k4w= X-Google-Smtp-Source: AGs4zMaNBHisFEVBmlfUO6HjFOiBX0uQg3wWC2jRUVmyRCz2g8fWeKUm0SRx1MGA3N2QiUE040/DjA== X-Received: by 10.84.245.22 with SMTP id i22mr5838011pll.123.1511067192806; Sat, 18 Nov 2017 20:53:12 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id j79sm2312952pfe.129.2017.11.18.20.53.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Nov 2017 20:53:12 -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 4/6 v3] mmc: sdhci-spear: Handle return value of platform_get_irq Date: Sun, 19 Nov 2017 10:22:46 +0530 Message-Id: <23382b551ade00543aadc588aa74b0648958b907.1511066652.git.arvind.yadav.cs@gmail.com> 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_205330_727943_1C971435 X-CRM114-Status: UNSURE ( 7.82 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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: Viresh Kumar --- 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-spear.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c index 8c0f884..e04485e 100644 --- a/drivers/mmc/host/sdhci-spear.c +++ b/drivers/mmc/host/sdhci-spear.c @@ -82,6 +82,10 @@ static int sdhci_probe(struct platform_device *pdev) host->hw_name = "sdhci"; host->ops = &sdhci_pltfm_ops; host->irq = platform_get_irq(pdev, 0); + if (host->irq <= 0) { + ret = -EINVAL; + goto err_host; + } host->quirks = SDHCI_QUIRK_BROKEN_ADMA; sdhci = sdhci_priv(host);