From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C18EAC77B7A for ; Wed, 7 Jun 2023 17:57:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231977AbjFGR5w (ORCPT ); Wed, 7 Jun 2023 13:57:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232400AbjFGR5w (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 1E0841FD4 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> Precedence: bulk List-ID: X-Mailing-List: linux-gpio@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