From patchwork Fri Dec 17 20:27:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Shtylyov X-Patchwork-Id: 12685653 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 AF2CFC433F5 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=XyhRQum3KvFnDIncOcypaE42kOVdFj+q73yV8mUxuGE=; b=mRsdQ0oG0zESKm 5v4LsWkMYvMj61SkQ6tIFIhjn1XBD6mc/DO2cidqC+XPymgdw5kzrOKssujq3N052oIlGp3O3PydC DacnisMUpllX5qqs0uPsAInoRf86QdZJSSNRs1EdStC12rdjlmiDybnu0DuX4aXobEhAaAM4FARd/ tbvOzr1lIZW1RWMpw2a9lmaZgvQqTQiYV4fwJLbWASntNh8FwwFF+pu+VYYUdzJMDsop6BWFFo71h ra5sSxUFly/Hee+9Z50lEUy4IVQguDmxutpXqKrPyPrdkAOrb4FcHhQTSriFc/P7LJUm03b6E4XTm rvWxlKglaRqmvcEGqdHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1myJpH-00CH24-Mx; 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-00CGzW-GG; Fri, 17 Dec 2021 20:27:33 +0000 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout02.lancloud.ru C086A20CC598 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 2/2] mmc: meson-mx-sdio: add IRQ check Date: Fri, 17 Dec 2021 23:27:17 +0300 Message-ID: <20211217202717.10041-3-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_761265_19AAB19A X-CRM114-Status: GOOD ( 11.53 ) 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: ed80a13bb4c4 ("mmc: meson-mx-sdio: Add a driver for the Amlogic Meson8 and Meson8b SoC") Signed-off-by: Sergey Shtylyov Reviewed-by: Martin Blumenstingl --- drivers/mmc/host/meson-mx-sdio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mmc/host/meson-mx-sdio.c b/drivers/mmc/host/meson-mx-sdio.c index d4a48916bfb6..3a19a05ef55a 100644 --- a/drivers/mmc/host/meson-mx-sdio.c +++ b/drivers/mmc/host/meson-mx-sdio.c @@ -662,6 +662,11 @@ static int meson_mx_mmc_probe(struct platform_device *pdev) } irq = platform_get_irq(pdev, 0); + if (irq < 0) { + ret = irq; + goto error_free_mmc; + } + ret = devm_request_threaded_irq(host->controller_dev, irq, meson_mx_mmc_irq, meson_mx_mmc_irq_thread, IRQF_ONESHOT,