linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Claudiu.Beznea@microchip.com>
To: <dan.carpenter@linaro.org>, <andriy.shevchenko@linux.intel.com>
Cc: <Ludovic.Desroches@microchip.com>, <linus.walleij@linaro.org>,
	<Nicolas.Ferre@microchip.com>, <alexandre.belloni@bootlin.com>,
	<linux-gpio@vger.kernel.org>, <kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] pinctrl: at91: fix a couple NULL vs IS_ERR() checks
Date: Tue, 23 May 2023 05:01:20 +0000	[thread overview]
Message-ID: <eaadf5e2-ff0e-d6e4-23c9-57d21878f26c@microchip.com> (raw)
In-Reply-To: <5697980e-f687-47a7-9db8-2af34ae464bd@kili.mountain>

On 22.05.2023 10:44, Dan Carpenter wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> The devm_kasprintf_strarray() function doesn't return NULL on error,
> it returns error pointers.  Update the checks accordingly.
> 
> Fixes: f494c1913cbb ("pinctrl: at91: use devm_kasprintf() to avoid potential leaks (part 2)")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>


> ---
>  drivers/pinctrl/pinctrl-at91.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
> index 871209c24153..39956d821ad7 100644
> --- a/drivers/pinctrl/pinctrl-at91.c
> +++ b/drivers/pinctrl/pinctrl-at91.c
> @@ -1389,8 +1389,8 @@ static int at91_pinctrl_probe(struct platform_device *pdev)
>                 char **names;
> 
>                 names = devm_kasprintf_strarray(dev, "pio", MAX_NB_GPIO_PER_BANK);
> -               if (!names)
> -                       return -ENOMEM;
> +               if (IS_ERR(names))
> +                       return PTR_ERR(names);
> 
>                 for (j = 0; j < MAX_NB_GPIO_PER_BANK; j++, k++) {
>                         char *name = names[j];
> @@ -1870,8 +1870,8 @@ static int at91_gpio_probe(struct platform_device *pdev)
>         }
> 
>         names = devm_kasprintf_strarray(dev, "pio", chip->ngpio);
> -       if (!names)
> -               return -ENOMEM;
> +       if (IS_ERR(names))
> +               return PTR_ERR(names);
> 
>         for (i = 0; i < chip->ngpio; i++)
>                 strreplace(names[i], '-', alias_idx + 'A');
> --
> 2.39.2
> 


  parent reply	other threads:[~2023-05-23  5:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22  7:44 [PATCH] pinctrl: at91: fix a couple NULL vs IS_ERR() checks Dan Carpenter
2023-05-22 21:18 ` Andy Shevchenko
2023-05-22 22:20 ` Ryan Wanner
2023-05-23  5:01 ` Claudiu.Beznea [this message]
2023-05-24  8:51 ` 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=eaadf5e2-ff0e-d6e4-23c9-57d21878f26c@microchip.com \
    --to=claudiu.beznea@microchip.com \
    --cc=Ludovic.Desroches@microchip.com \
    --cc=Nicolas.Ferre@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dan.carpenter@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    /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).