Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp501320rwd; Wed, 7 Jun 2023 03:04:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4k1CV+ER4SXlpatsrW1EZIUO0wgHLfKAF7WVICaKTUK2HuVKBZuahzAizNmJy7oNbOtoKb X-Received: by 2002:a05:6a20:394f:b0:10c:edb:3e09 with SMTP id r15-20020a056a20394f00b0010c0edb3e09mr1170262pzg.25.1686132297374; Wed, 07 Jun 2023 03:04:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686132297; cv=none; d=google.com; s=arc-20160816; b=LJCrG0YT+M7y06/Uj6o0+Cl5lUUeIb9ykDmEMydoYasYZGuq//cabLQi2S05/IPb7i m2Ca6UoTsGveUVmOW4rgSoPhzyhDOqF2L8D7nnvARcA/kY0vFF9GdSsNJdU51690ad/R PTco/jAOWSvboIlhoBkS2BAGD84/9pXu+cBxc3BHbdOctsEbjVgkImXmf95Uckv0g2o+ vvo6nk/MPfr3HwpvZSK8Gxu8Xzh8eISOT3UtUpyeRH+clYRAaZJb6N2pf9BtckUgUL4F elBCQsr1k0gnIy5vtZx34Hv9qxTlWjtolViaNAa+6BlDCHsTQTvQd56zgoqVl88jwTsZ jy1Q== 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=t5VVSLoE8IZpj/rMyWrhTH+X33/wQK1FHy5NBEHNhKI=; b=Wh9dcg9B7nQwI6Le7nM/6b6YIx0nzSl1Maemzd52KHuta5rep6Qrq1ZUHpyqK99T/g n6kF+kRw4yD2Nz5x3DUGggJ+Q1PqhZzg3BY80UvuX4J4wwTco62LkyZmx0bJCcsFzYfV TYLfJO+SuYaigrNyrjiwT4OgkMagSro5c6fsAfumbgmFBhr0bYOZU2DwykX6o5egelm+ NskPa/0VVfZzHDZCVlUq2ZZTO/0dW2Oi0fZvkbfFC8aBQuHRiX3m+lY/y4J/gS+yd+ce KRJ6wsuA1v0ZDlmWYVEcpFnIqjuy+AlTYBqfUVdqrpZKG3I3riiaAGixJm3Ue9cBjy+h CdYQ== 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 p3-20020a170902b08300b001b214c2bc05si4264530plr.42.2023.06.07.03.04.44; Wed, 07 Jun 2023 03:04:57 -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 S238762AbjFGJ6r (ORCPT + 99 others); Wed, 7 Jun 2023 05:58:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234789AbjFGJ6q (ORCPT ); Wed, 7 Jun 2023 05:58:46 -0400 Received: from cstnet.cn (smtp81.cstnet.cn [159.226.251.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B1331982; Wed, 7 Jun 2023 02:58:44 -0700 (PDT) Received: from ed3e173716be.home.arpa (unknown [124.16.138.125]) by APP-03 (Coremail) with SMTP id rQCowABnRxzGVIBkuOu0DA--.1610S2; Wed, 07 Jun 2023 17:58:31 +0800 (CST) From: Jiasheng Jiang To: avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, linus.walleij@linaro.org Cc: openbmc@lists.ozlabs.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] pinctrl: npcm7xx: Add missing check for ioremap Date: Wed, 7 Jun 2023 17:58:29 +0800 Message-Id: <20230607095829.1345-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: rQCowABnRxzGVIBkuOu0DA--.1610S2 X-Coremail-Antispam: 1UD129KBjvdXoW7Xw4UtryUZr43KrW5ZrW8JFb_yoWftrg_uF 97WF9xJ3yDCana9ryjqw18ZFy0yF47XF1FqFsaqFZ3Cr9rAw1aqryvvrW5G3Z7Wr47JryU G3y7Ga45J34UAjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbV8FF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr0_ Cr1l84ACjcxK6I8E87Iv67AKxVWxJr0_GcWl84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r106r15McIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxa n2IY04v7MxkIecxEwVAFwVW8uwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJV W8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF 1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6x IIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvE x4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvj DU0xZFpf9x0JUSsjbUUUUU= 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 check for ioremap() and return the error if it fails in order to guarantee the success of ioremap(). Fixes: 3b588e43ee5c ("pinctrl: nuvoton: add NPCM7xx pinctrl and GPIO driver") Signed-off-by: Jiasheng Jiang --- drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c index 21e61c2a3798..843ffcd96877 100644 --- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c +++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c @@ -1884,6 +1884,8 @@ static int npcm7xx_gpio_of(struct npcm7xx_pinctrl *pctrl) } pctrl->gpio_bank[id].base = ioremap(res.start, resource_size(&res)); + if (!pctrl->gpio_bank[id].base) + return -EINVAL; ret = bgpio_init(&pctrl->gpio_bank[id].gc, dev, 4, pctrl->gpio_bank[id].base + NPCM7XX_GP_N_DIN, -- 2.25.1