From patchwork Sun Nov 19 04:52:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10065077 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 5B8D0602CB for ; Sun, 19 Nov 2017 05:04:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5584A294CB for ; Sun, 19 Nov 2017 05:04:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A164294CD; Sun, 19 Nov 2017 05:04:41 +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 059CA294CB for ; Sun, 19 Nov 2017 05:04:41 +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=VCG+In9CdVR8HUk7vwz0VDh2vWFAe6qYmd4jg+7Be4g=; b=GIeVh6mWu2IYSI1DUDPdyz8DOD Cg+nn+TRa5QYGopPeIUSYmaQr9oeMtVvutW1LbQql2jThuTezMzOrAZzAW1xuz+k7TKLtl2WtKlpt ffWGSh/m94hb8ju8VaH65ydaW8SNRSfQfUevBHjPl2bIN/6dl7C89bxFF3tm5OyppNUnUoewumzkh XPFjotn0mt/myCwHGfIi6VFVrnUdvxkaEyp3kzuT1KYzZE9DLvVpLHDtPqsNpOUvvgahwtn016iSv xAfNCQixi/Dw4lT0+UE5Jc38ViWBvxCXcK6gse91gHYumQjJhu4j/G+3joXT1vKtA2VN0Keg51aST G9S9QbEg==; 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 1eGHmR-0007D0-G5; Sun, 19 Nov 2017 05:04:31 +0000 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eGHbt-0000QZ-QQ; Sun, 19 Nov 2017 04:53:43 +0000 Received: by mail-pg0-x244.google.com with SMTP id o7so4878026pgc.4; Sat, 18 Nov 2017 20:53:17 -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=SHqaDbXlpj8m5Dxv4a41QHY3l6JisdvVUmBIlgDwrB4=; b=VFOAmKsMhj9HKcfa0dSKExlOtveBO3wd8k/AQrYEu05bh7Ittk3IuqCjF9agc8RLFk G/n2PBYgob0nxEHOL6zkJzim7LBjbxV5kSp00vz6Z8jjfwJSKGKiqffMQtPLBQSQ120B fmwyNE5Z/7cKRFOHtgapAEenTfy0kEXo7PWpL9CUZRcJS6YRtYi1VMvLvCVry4GoXaCE 001JUCzK1LEV9w6HQxl6H3S7JEkdm680PT5jyfBRgLV2eP3Oliyp1om6Dt6vFwu6YWIR S1bB6Xi5Mra4cyH+PEIs1pkOqOPnlT2LykuWrvP665sbLAlLZdwlslFaQNtCGJkTXnv7 LoBw== 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=SHqaDbXlpj8m5Dxv4a41QHY3l6JisdvVUmBIlgDwrB4=; b=bgYPw0uzqtQvxg0EUUcvTqWYOohwnM79ExE0SBl1jNYY7nw+bZFI+3sjs3ytGBouaq JCg9qu2WvYU5KRGGsyNxJXHoUO3m14jabwagf+gKSFg0Ss5VkFEmDO7F6twYDQrGhcLn Z36jEfBh6461c9OXM8jxUEiWAYOxeYkUwIFopjXgg8LckPrLbraBXz7qi7TX+IanBDkF Qsn0jlO08FtvqDvhE1DBCm9CSPUkW0aNg7suNuPKeodxBADXt5Bqw4WcEgUJOm6TVG9V HdmRBKtGeSUcz/u4BiIl0IdEZ8cK4U3EijqIbQTSqoO9YdyAzGH1xNNVTn+ErTssTkxy 4vrw== X-Gm-Message-State: AJaThX6nGCbx0cTFUShAMvw7+uYvcBFnCx+Y0iPX8eztNTFaLUQLpLko Zt5ya5dcsGltnP47ZHNFmLM= X-Google-Smtp-Source: AGs4zMYqDURsxp9SKqZ10hZXE1GCO4LWe1ajfkoFxJ3KTKfK9Yrqhu40JBI7BLuhrlyJFGoHnb5Jng== X-Received: by 10.84.209.136 with SMTP id y8mr9997466plh.439.1511067197249; Sat, 18 Nov 2017 20:53:17 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id j79sm2312952pfe.129.2017.11.18.20.53.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Nov 2017 20:53:16 -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 6/6 v3] mmc: sunxi-mmc: Handle return value of platform_get_irq Date: Sun, 19 Nov 2017 10:22:47 +0530 Message-Id: <6ad5c6077b96353a77ea30d1b64651c77d5622f6.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_205338_383346_425D4444 X-CRM114-Status: UNSURE ( 8.31 ) 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 --- 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/sunxi-mmc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c index cc98355d..c926ac8 100644 --- a/drivers/mmc/host/sunxi-mmc.c +++ b/drivers/mmc/host/sunxi-mmc.c @@ -1255,6 +1255,11 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host, goto error_assert_reset; host->irq = platform_get_irq(pdev, 0); + if (host->irq <= 0) { + ret = -EINVAL; + goto error_assert_reset; + } + return devm_request_threaded_irq(&pdev->dev, host->irq, sunxi_mmc_irq, sunxi_mmc_handle_manual_stop, 0, "sunxi-mmc", host);