Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1118073rwd; Wed, 7 Jun 2023 11:12:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5RoPBHyJGMGVe5YcedmWcYfs0WMqjsl4mO/8R3Pn26sLKdqlbWQW/LF4betxkJorG4jySY X-Received: by 2002:a05:6a20:394f:b0:10c:edb:3e09 with SMTP id r15-20020a056a20394f00b0010c0edb3e09mr2366302pzg.25.1686161574876; Wed, 07 Jun 2023 11:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686161574; cv=none; d=google.com; s=arc-20160816; b=hZ7Jk0XFS0n3VCFczUDHswjIBIssUYmQgCzHADSWZOk+d1gSd0FMhP2orVi8ZieXFW ySwHoaMlPqvEXzssMhBosWqkchUUZovZq44I7kBXBN3KYavw4t/cZKIhu3/YoAmp2LmL zJVrI5ew1aQX1YoE/oXwe4G9KHbr2z2f+yg92/NODK8+f7WL5e+WcMRtvdF1rwBWTKjK uvUfQ/R6XYZ9vy3FEGZa2ZzP3okAToyp76v0iVIeSpSOqErw1ypq18Sz2eXLVoixcywq OiOgqggcn+fs1uA1SCni0XpjTUyyBmmLTWHGdjp/wF9oSIByMCw7XTQOj1amaF339/6e 3+iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from; bh=3RWS4Ip6ZuYC+oZTo5BxSZGWg2or2g3HmNDxhmU3wOc=; b=sfXQdmMnL/djivX2wIRtkgDnOTqwoBX8FMqrOpkwc+9K+yUM2GlVlJ7rmbu3TIaQ2w mytp7upfVpkHTGsCsRmIiNZEqFwyxI4YX+L7yS+fmPNeY3/NQ6QWt6lc/gqbpolwryHJ v1+vYC2Wo0zVDURcD770HTr6GwoagXe5L4Gl20uXI21FljdPml+YXjxqBG6G3hqf6LWw s10zJuVHsldVGbly0+3wzc7Ki8BAKRq38jfNHjYiNB2hDWZrIBecsDJD/YnU7/0YS8e9 nCdI8DVkfacKewXse5c4lrpkExkyKXjsga+jv3GD08oWE0zlFH++QroScTWbacP1iWAI TWyw== 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z127-20020a626585000000b0064354230c2asi8974364pfb.367.2023.06.07.11.12.42; Wed, 07 Jun 2023 11:12:54 -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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232400AbjFGR5x (ORCPT + 99 others); Wed, 7 Jun 2023 13:57:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229980AbjFGR5w (ORCPT ); Wed, 7 Jun 2023 13:57:52 -0400 Received: from fgw23-7.mail.saunalahti.fi (fgw23-7.mail.saunalahti.fi [62.142.5.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DF1D1FC2 for ; Wed, 7 Jun 2023 10:57:49 -0700 (PDT) Received: from localhost (88-113-24-87.elisa-laajakaista.fi [88.113.24.87]) by fgw23.mail.saunalahti.fi (Halon) with ESMTP id c846300f-055c-11ee-b972-005056bdfda7; Wed, 07 Jun 2023 20:57:35 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Wed, 7 Jun 2023 20:57:34 +0300 To: Jiasheng Jiang Cc: avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, linus.walleij@linaro.org, openbmc@lists.ozlabs.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] pinctrl: npcm7xx: Add missing check for ioremap Message-ID: References: <20230607095829.1345-1-jiasheng@iscas.ac.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230607095829.1345-1-jiasheng@iscas.ac.cn> X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no 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 Wed, Jun 07, 2023 at 05:58:29PM +0800, Jiasheng Jiang kirjoitti: > Add check for ioremap() and return the error if it fails in order to > guarantee the success of ioremap(). This one is correct, otherwise the GPIO is not functional at all. Reviewed-by: Andy Shevchenko > 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, -- With Best Regards, Andy Shevchenko