* Re: [PATCH] pinctrl: at91: fix a couple NULL vs IS_ERR() checks
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
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2023-05-22 21:18 UTC (permalink / raw)
To: Dan Carpenter
Cc: Ludovic Desroches, Linus Walleij, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea, linux-gpio, kernel-janitors
On Mon, May 22, 2023 at 10:44:54AM +0300, Dan Carpenter wrote:
> The devm_kasprintf_strarray() function doesn't return NULL on error,
> it returns error pointers. Update the checks accordingly.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Thanks!
> Fixes: f494c1913cbb ("pinctrl: at91: use devm_kasprintf() to avoid potential leaks (part 2)")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> 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
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] pinctrl: at91: fix a couple NULL vs IS_ERR() checks
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
2023-05-24 8:51 ` Linus Walleij
3 siblings, 0 replies; 5+ messages in thread
From: Ryan Wanner @ 2023-05-22 22:20 UTC (permalink / raw)
To: Dan Carpenter, Andy Shevchenko
Cc: Ludovic Desroches, Linus Walleij, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea, linux-gpio, kernel-janitors
On 5/22/23 00:44, Dan Carpenter wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> 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>
Acked-by: Ryan Wanner <ryan.wanner@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
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] pinctrl: at91: fix a couple NULL vs IS_ERR() checks
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
2023-05-24 8:51 ` Linus Walleij
3 siblings, 0 replies; 5+ messages in thread
From: Claudiu.Beznea @ 2023-05-23 5:01 UTC (permalink / raw)
To: dan.carpenter, andriy.shevchenko
Cc: Ludovic.Desroches, linus.walleij, Nicolas.Ferre,
alexandre.belloni, linux-gpio, kernel-janitors
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
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] pinctrl: at91: fix a couple NULL vs IS_ERR() checks
2023-05-22 7:44 [PATCH] pinctrl: at91: fix a couple NULL vs IS_ERR() checks Dan Carpenter
` (2 preceding siblings ...)
2023-05-23 5:01 ` Claudiu.Beznea
@ 2023-05-24 8:51 ` Linus Walleij
3 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2023-05-24 8:51 UTC (permalink / raw)
To: Dan Carpenter
Cc: Andy Shevchenko, Ludovic Desroches, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea, linux-gpio, kernel-janitors
On Mon, May 22, 2023 at 9:45 AM Dan Carpenter <dan.carpenter@linaro.org> wrote:
> 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>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread