From: andy.shevchenko@gmail.com
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>
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
Date: Wed, 7 Jun 2023 20:57:34 +0300 [thread overview]
Message-ID: <ZIDFDgcM07aPlzoB@surfacebook> (raw)
In-Reply-To: <20230607095829.1345-1-jiasheng@iscas.ac.cn>
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 <andy.shevchenko@gmail.com>
> Fixes: 3b588e43ee5c ("pinctrl: nuvoton: add NPCM7xx pinctrl and GPIO driver")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> 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
next prev parent reply other threads:[~2023-06-07 17:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 9:58 [PATCH] pinctrl: npcm7xx: Add missing check for ioremap Jiasheng Jiang
2023-06-07 17:57 ` andy.shevchenko [this message]
2023-06-09 7:43 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZIDFDgcM07aPlzoB@surfacebook \
--to=andy.shevchenko@gmail.com \
--cc=avifishman70@gmail.com \
--cc=benjaminfair@google.com \
--cc=jiasheng@iscas.ac.cn \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=openbmc@lists.ozlabs.org \
--cc=tali.perry1@gmail.com \
--cc=tmaimon77@gmail.com \
--cc=venture@google.com \
--cc=yuenn@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).