From patchwork Tue Jun 6 03:18:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 13268196 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 859A3C7EE25 for ; Tue, 6 Jun 2023 03:19:31 +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: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:In-Reply-To:References: List-Owner; bh=HPmDOIqDIx8E5GQVBKQR0rUWGSCNoALINqvPMjO52Ek=; b=BSOFbVkuBXpKuo Yj5Aw9QYL6LZ2SgbxrVyHR/X1iwXxMcoWvNuK1Rf+7KIA2qer5Q9+S4DZ/OT+c9Dm/rKYLfhfVKcU bQRMuQQXk/WQRDirVaB9XN4W4R9sTkmVbj77gEgFtD7HowrYyRl4QF2K91vbF+YXqB++SAxGRMoU+ +P2cDkNmV/v/2uNQ1VdIPyUZ73Up0klYa8VSD+YmvI8/nYkncFhq1QtkvebrPZZn0vImtuRhcseV1 2vugIwupnwnzXVXTDVttuj3d3oRTGU41TwOJKGR5ABvIZFpBYWcGM5YUTvnXQpn14WmNRew2iioNE XC6wDgfsGX9/qJpHZolg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q6NED-00HXIn-2b; Tue, 06 Jun 2023 03:19:25 +0000 Received: from smtp80.cstnet.cn ([159.226.251.80] helo=cstnet.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q6NEA-00HXHA-0j for linux-riscv@lists.infradead.org; Tue, 06 Jun 2023 03:19:24 +0000 Received: from ed3e173716be.home.arpa (unknown [124.16.138.125]) by APP-01 (Coremail) with SMTP id qwCowAA3PJiTpX5keCo0DA--.2532S2; Tue, 06 Jun 2023 11:18:45 +0800 (CST) From: Jiasheng Jiang To: andy.shevchenko@gmail.com Cc: oe-kbuild-all@lists.linux.dev, linus.walleij@linaro.org, brgl@bgdev.pl, palmer@dabbelt.com, paul.walmsley@sifive.com, linux-gpio@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH v3] gpio: ath79: Add missing check for platform_get_irq Date: Tue, 6 Jun 2023 11:18:41 +0800 Message-Id: <20230606031841.38665-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: qwCowAA3PJiTpX5keCo0DA--.2532S2 X-Coremail-Antispam: 1UD129KBjvdXoW7JFyfuF1rXr43tw43Cry5XFb_yoWkWrc_Cw 1kXw17Cr48ur9IqF17Aw1ayrWSyr97urn3Zr4vqa1aqr98Z397ur9rur4rZrnrWr18KFyD G34kCrWavFsxGjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbVAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr0_ Gr1UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Cr 1j6rxdM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj 6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr 0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E 8cxan2IY04v7MxkIecxEwVAFwVW8GwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbV WUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF 67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42 IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF 0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxh VjvjDU0xZFpf9x0JUk3ktUUUUU= X-Originating-IP: [124.16.138.125] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230605_201922_677678_16ED3D19 X-CRM114-Status: GOOD ( 11.81 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add the missing check for platform_get_irq() and return error if it fails. The returned error code will be dealed with in module_platform_driver(ath79_gpio_driver) and the driver will not be registered. Fixes: 2b8f89e19b6d ("gpio: ath79: Add support for the interrupt controller") Signed-off-by: Jiasheng Jiang --- Changelog: v2 -> v3: 1. Check before assigning values. v1 -> v2: 1. Return "girq->parents[0]" instead of "-ENODEV". --- drivers/gpio/gpio-ath79.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-ath79.c b/drivers/gpio/gpio-ath79.c index aa0a954b8392..d2d838ad33bb 100644 --- a/drivers/gpio/gpio-ath79.c +++ b/drivers/gpio/gpio-ath79.c @@ -285,7 +285,10 @@ static int ath79_gpio_probe(struct platform_device *pdev) GFP_KERNEL); if (!girq->parents) return -ENOMEM; - girq->parents[0] = platform_get_irq(pdev, 0); + err = platform_get_irq(pdev, 0); + if (err < 0) + return err; + girq->parents[0] = err; girq->default_type = IRQ_TYPE_NONE; girq->handler = handle_simple_irq; }