From patchwork Fri Dec 17 20:27:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12685651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C68CC433EF for ; Fri, 17 Dec 2021 20:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fGv87PYEoF3iY16d9+XrnURVBtv/u0Ywoxy78v9g3x0=; b=wxOJtzzdM9sDxD ctcavdiC69JVVmZ1XQvYFao6CYx0ZUY/9hVY+WeViAy9hL+ZjVZaYmOFFWsatXEyDmu6ECH+GzuV7 Q40Q96uWhk7JiGPQGIk65lrwQEEtFRSZSVWHMTBb5bIJX86S81EbT7HfkdB+2rspENbD/qzqyej3M BANdApIcAFsX26H2ZyQPf6P3wVi7W2pG4r4Z1u5AKYhRTRSDiLuas8U7C1Bc7shZyVwGeWIbL36QK 4lBXljK5CDbDpAxaDg01hq32afc6QYGNtnjXzY7iGHysJmGu1UmLVxZLG5ixAyoPDf3B3oOYVBiyj qSL1Mo9shw+t417mGPmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1myJpG-00CH1i-Vs; Fri, 17 Dec 2021 20:27:35 +0000 Received: from mxout02.lancloud.ru ([45.84.86.82]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1myJpD-00CGzY-G8; Fri, 17 Dec 2021 20:27:33 +0000 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout02.lancloud.ru 0DA0120CC3BA Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov To: Ulf Hansson , CC: Neil Armstrong , Kevin Hilman , Jerome Brunet , "Martin Blumenstingl" , , Subject: [PATCH 1/2] mmc: meson-mx-sdhc: add IRQ check Date: Fri, 17 Dec 2021 23:27:16 +0300 Message-ID: <20211217202717.10041-2-s.shtylyov@omp.ru> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20211217202717.10041-1-s.shtylyov@omp.ru> References: <20211217202717.10041-1-s.shtylyov@omp.ru> MIME-Version: 1.0 X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211217_122731_761375_5F3B34F9 X-CRM114-Status: GOOD ( 10.83 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_threaded_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_threaded_irq() with the invalid IRQ #s. Fixes: e4bf1b0970ef ("mmc: host: meson-mx-sdhc: new driver for the Amlogic Meson SDHC host") Signed-off-by: Sergey Shtylyov Reviewed-by: Martin Blumenstingl --- drivers/mmc/host/meson-mx-sdhc-mmc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c index 7cd9c0ec2fcf..b6a1f25903a2 100644 --- a/drivers/mmc/host/meson-mx-sdhc-mmc.c +++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c @@ -838,6 +838,11 @@ static int meson_mx_sdhc_probe(struct platform_device *pdev) goto err_disable_pclk; irq = platform_get_irq(pdev, 0); + if (irq < 0) { + ret = irq; + goto err_disable_pclk; + } + ret = devm_request_threaded_irq(dev, irq, meson_mx_sdhc_irq, meson_mx_sdhc_irq_thread, IRQF_ONESHOT, NULL, host);