Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6534153rwd; Mon, 5 Jun 2023 20:53:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4J9mv5hLX84oC4HCc0wAgJjUq3PkFpqaKyKPk9ZVIgVRdOHjZBYilgLSf0SKLD22zUZ7qX X-Received: by 2002:a05:620a:2453:b0:75e:a04f:fb91 with SMTP id h19-20020a05620a245300b0075ea04ffb91mr961360qkn.31.1686023621143; Mon, 05 Jun 2023 20:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686023621; cv=none; d=google.com; s=arc-20160816; b=Td2FRWZqhb0NODRxqdl0vwpTngciQJY4DeGYEYLW1aJqjiiHV/pbHcnhgu3qXHCIo5 SktfrNajLrKXfoYa51lcm350QR6uG99gdc/ULv1vk1r6+vnwMV/1FLMPODD6ESIP6V+H IqtYRtPQ39IBtnDOGrhjaMgTATHEqwflQEJimtadCoj32RPjZBbZxhldeZ4Kvf6brxWI UOb/vfchX+HBia6p6tZVNnJiU26JC2eR+RJcfwH3OOmzdp2rqlFKKRPc4YurQvf5rfAz kT7oKAiqLuY3fntwRtoOpw43X6Jr3vuMeE4Wr19zivb7aYsAr8AQfq3ObuiafImcN/nO 1Fbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=XtHjS0TDts9hucpeDl1vldWdrTs7Hfm8g3GoPF1RcQA=; b=bZ839sKkMqLqkAwE3iGz+XqgNtbF/rm7KHg7E9OqOeEU+Nh8KxJykCD9KNnvUdL+jp L0QNQHQJmTYSqwiy2VNArtesbUEQkObTSznKgkpLbInrNOwrkKotJGz5UZeywd8+cTgR YMp/Tm3vDOfoKuJm8MAzkoLUYZPuXYLD1FThyPrb28JXFwFJuaV3Si2eI2y+/0UbhzBE BVg1CStY02SRB5c4p16wT4tm/hs3lCBONxslTKoJOO5SFKsctUWa9W2TmGcGoAku6nKd 1ybqBcPZOuvMYEPET6Mb1vZTgwEPhXM0sJWHvAljAqm0aEwQ93DieZrjB8ZebglhlO2e 9Zhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020a37c408000000b0075cc868abfbsi5279961qki.573.2023.06.05.20.53.25; Mon, 05 Jun 2023 20:53:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233504AbjFFDT2 (ORCPT + 99 others); Mon, 5 Jun 2023 23:19:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230362AbjFFDT0 (ORCPT ); Mon, 5 Jun 2023 23:19:26 -0400 Received: from cstnet.cn (smtp80.cstnet.cn [159.226.251.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94032118; Mon, 5 Jun 2023 20:19:24 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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; } -- 2.25.1