Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp405935rwd; Thu, 1 Jun 2023 01:45:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5gtUobCpQGIt7a9WSJgQ0UZ8bSiJzafhaTuhAF5TBsUgwrXhi1AEdioMNWd7j4uXnBoxJH X-Received: by 2002:ac8:5e52:0:b0:3f3:8c37:f1ee with SMTP id i18-20020ac85e52000000b003f38c37f1eemr10014321qtx.53.1685609155120; Thu, 01 Jun 2023 01:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685609155; cv=none; d=google.com; s=arc-20160816; b=xT5IO4z09AJW4JUE7Dzx3yfBLWaL8uYdxvIl+Vwx/cECx+xhe/IgrgMB/rbOJdK7xX jYaGBixNib7wxRmqX3+k1fh6GC5t+rSFqpo53ygSTvjP4p5beqiOUD9pmXZz+4UwXF5J pYayui4XwV1PgxbtWeNVOmyS04qvE0v6/o3tXRP6x3TAU5W+g3Re/TLWN3ak9FYRNDOM UKtliSimNkkpH6RO+rijl+0QN31Zis+DHV4MoAw496cNKI/cawE1AODljfk9aM1ngD9x lQIlHhiWuCMChV50IrevMIzFeUNrDnVZ4Wo/PqIkAgfJHM8YuDQHgKufKl77pLM3/r6O 8g8Q== 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=YxRjBYqiibudz8UnGY92vBg1yibTr+8XFvzDVoQlYN8=; b=v8OC7gThf7f1D8N+KlZuR7Ek8cC/sCKiVLEHJzTD06QnnpKAQECfVkaBlBHG14ktg5 /yYY64hDZnlFnrs/RGrp+k2TLXLyafooxaAAPFUZt6cKB//fWZDXxErBP03P8GihV8MK iCNebtHPThekmZGLuUalrMxPB67C46uEB3f6qnVOCCdvBgI22gl9pHiLZUQovz+ipC1p ezBhcCZDlxIpVk/7Aj5lXqMTCQI05XtmuwYSJOOZTI64iDzMatxirq49XTXsD4T32bp+ zFYHSjd+yeHMmNgzxwRB/LC4daQ8dmiqWSyPjh/GDEFGmu0LkBjGWp3k2I2aRbZvdux9 b2Pg== 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 w16-20020a639350000000b00524b2358ffcsi1052875pgm.574.2023.06.01.01.45.42; Thu, 01 Jun 2023 01:45:55 -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 S232295AbjFAIcE (ORCPT + 99 others); Thu, 1 Jun 2023 04:32:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232179AbjFAIbQ (ORCPT ); Thu, 1 Jun 2023 04:31:16 -0400 X-Greylist: delayed 357 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 01 Jun 2023 01:30:45 PDT Received: from cstnet.cn (smtp25.cstnet.cn [159.226.251.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6D4E133; Thu, 1 Jun 2023 01:30:45 -0700 (PDT) Received: from localhost.localdomain (unknown [124.16.138.125]) by APP-05 (Coremail) with SMTP id zQCowACnrpLJVXhkdUgwCQ--.53814S2; Thu, 01 Jun 2023 16:24:42 +0800 (CST) From: Jiasheng Jiang To: linus.walleij@linaro.org, brgl@bgdev.pl, palmer@dabbelt.com, paul.walmsley@sifive.com Cc: linux-gpio@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] gpio: sifive: Add missing check for platform_get_irq Date: Thu, 1 Jun 2023 16:24:40 +0800 Message-Id: <20230601082440.30110-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: zQCowACnrpLJVXhkdUgwCQ--.53814S2 X-Coremail-Antispam: 1UD129KBjvdXoW7Jw1UtrykKF17Ww43Ww4DJwb_yoWfJFg_Gw 1kuFW7X3y0vFn0gF12y3yayr92vF95Wrn3ursakFyftryDu348ur17Xrs5ZFnxXr4UtFy7 Gay8uw47Aa13GjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbckFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr0_ Gr1UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Cr 1j6rxdM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj 6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr 0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkIecxEwVAFwVW8 ZwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r 1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij 64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr 0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF 0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUhdbbUUUUU= X-Originating-IP: [124.16.138.125] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 missing check for platform_get_irq and return error if it fails. Fixes: f52d6d8b43e5 ("gpio: sifive: To get gpio irq offset from device tree data") Signed-off-by: Jiasheng Jiang --- drivers/gpio/gpio-sifive.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c index 98939cd4a71e..7bca9c415564 100644 --- a/drivers/gpio/gpio-sifive.c +++ b/drivers/gpio/gpio-sifive.c @@ -221,8 +221,11 @@ static int sifive_gpio_probe(struct platform_device *pdev) return -ENODEV; } - for (i = 0; i < ngpio; i++) + for (i = 0; i < ngpio; i++) { chip->irq_number[i] = platform_get_irq(pdev, i); + if (chip->irq_number[i] < 0) + return -ENODEV; + } ret = bgpio_init(&chip->gc, dev, 4, chip->base + SIFIVE_GPIO_INPUT_VAL, -- 2.25.1