All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] pinctrl: nuvoton: Fix return value check in wpcm450_gpio_register()
@ 2022-03-17  6:58 ` Jialin Zhang
  0 siblings, 0 replies; 6+ messages in thread
From: Jialin Zhang @ 2022-03-17  6:58 UTC (permalink / raw)
  To: j.neuschaefer, linus.walleij; +Cc: openbmc, linux-gpio, linux-kernel

In case of error, the function devm_platform_ioremap_resource()
returns ERR_PTR() and never returns NULL. The NULL test in the
return value check should be replaced with IS_ERR().

Fixes: a1d1e0e3d80a ("pinctrl: nuvoton: Add driver for WPCM450")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
---
 drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
index 661aa963e3fc..a71b684b9b44 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
@@ -1019,8 +1019,9 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
 	int ret;
 
 	pctrl->gpio_base = devm_platform_ioremap_resource(pdev, 0);
-	if (!pctrl->gpio_base)
-		return dev_err_probe(dev, -ENOMEM, "Resource fail for GPIO controller\n");
+	if (IS_ERR(pctrl->gpio_base))
+		return dev_err_probe(dev, PTR_ERR(pctrl->gpio_base),
+				     "Resource fail for GPIO controller\n");
 
 	device_for_each_child_node(dev, child)  {
 		void __iomem *dat = NULL;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH -next] pinctrl: nuvoton: Fix return value check in wpcm450_gpio_register()
@ 2022-03-17  6:58 ` Jialin Zhang
  0 siblings, 0 replies; 6+ messages in thread
From: Jialin Zhang @ 2022-03-17  6:58 UTC (permalink / raw)
  To: j.neuschaefer, linus.walleij; +Cc: linux-gpio, openbmc, linux-kernel

In case of error, the function devm_platform_ioremap_resource()
returns ERR_PTR() and never returns NULL. The NULL test in the
return value check should be replaced with IS_ERR().

Fixes: a1d1e0e3d80a ("pinctrl: nuvoton: Add driver for WPCM450")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
---
 drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
index 661aa963e3fc..a71b684b9b44 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
@@ -1019,8 +1019,9 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
 	int ret;
 
 	pctrl->gpio_base = devm_platform_ioremap_resource(pdev, 0);
-	if (!pctrl->gpio_base)
-		return dev_err_probe(dev, -ENOMEM, "Resource fail for GPIO controller\n");
+	if (IS_ERR(pctrl->gpio_base))
+		return dev_err_probe(dev, PTR_ERR(pctrl->gpio_base),
+				     "Resource fail for GPIO controller\n");
 
 	device_for_each_child_node(dev, child)  {
 		void __iomem *dat = NULL;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] pinctrl: nuvoton: Fix return value check in wpcm450_gpio_register()
  2022-03-17  6:58 ` Jialin Zhang
@ 2022-03-17 11:24   ` Jonathan Neuschäfer
  -1 siblings, 0 replies; 6+ messages in thread
From: Jonathan Neuschäfer @ 2022-03-17 11:24 UTC (permalink / raw)
  To: Jialin Zhang
  Cc: j.neuschaefer, linus.walleij, openbmc, linux-gpio, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]

On Thu, Mar 17, 2022 at 02:58:51PM +0800, Jialin Zhang wrote:
> In case of error, the function devm_platform_ioremap_resource()
> returns ERR_PTR() and never returns NULL. The NULL test in the
> return value check should be replaced with IS_ERR().

Right.

> 
> Fixes: a1d1e0e3d80a ("pinctrl: nuvoton: Add driver for WPCM450")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
> ---
>  drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> index 661aa963e3fc..a71b684b9b44 100644
> --- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> +++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> @@ -1019,8 +1019,9 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
>  	int ret;
>  
>  	pctrl->gpio_base = devm_platform_ioremap_resource(pdev, 0);
> -	if (!pctrl->gpio_base)
> -		return dev_err_probe(dev, -ENOMEM, "Resource fail for GPIO controller\n");
> +	if (IS_ERR(pctrl->gpio_base))
> +		return dev_err_probe(dev, PTR_ERR(pctrl->gpio_base),
> +				     "Resource fail for GPIO controller\n");
>  

Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>


Thanks!
Jonathan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] pinctrl: nuvoton: Fix return value check in wpcm450_gpio_register()
@ 2022-03-17 11:24   ` Jonathan Neuschäfer
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Neuschäfer @ 2022-03-17 11:24 UTC (permalink / raw)
  To: Jialin Zhang
  Cc: linux-gpio, linus.walleij, j.neuschaefer, linux-kernel, openbmc

[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]

On Thu, Mar 17, 2022 at 02:58:51PM +0800, Jialin Zhang wrote:
> In case of error, the function devm_platform_ioremap_resource()
> returns ERR_PTR() and never returns NULL. The NULL test in the
> return value check should be replaced with IS_ERR().

Right.

> 
> Fixes: a1d1e0e3d80a ("pinctrl: nuvoton: Add driver for WPCM450")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
> ---
>  drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> index 661aa963e3fc..a71b684b9b44 100644
> --- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> +++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> @@ -1019,8 +1019,9 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
>  	int ret;
>  
>  	pctrl->gpio_base = devm_platform_ioremap_resource(pdev, 0);
> -	if (!pctrl->gpio_base)
> -		return dev_err_probe(dev, -ENOMEM, "Resource fail for GPIO controller\n");
> +	if (IS_ERR(pctrl->gpio_base))
> +		return dev_err_probe(dev, PTR_ERR(pctrl->gpio_base),
> +				     "Resource fail for GPIO controller\n");
>  

Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>


Thanks!
Jonathan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] pinctrl: nuvoton: Fix return value check in wpcm450_gpio_register()
  2022-03-17  6:58 ` Jialin Zhang
@ 2022-03-24  0:39   ` Linus Walleij
  -1 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2022-03-24  0:39 UTC (permalink / raw)
  To: Jialin Zhang; +Cc: j.neuschaefer, openbmc, linux-gpio, linux-kernel

On Thu, Mar 17, 2022 at 7:49 AM Jialin Zhang <zhangjialin11@huawei.com> wrote:

> In case of error, the function devm_platform_ioremap_resource()
> returns ERR_PTR() and never returns NULL. The NULL test in the
> return value check should be replaced with IS_ERR().
>
> Fixes: a1d1e0e3d80a ("pinctrl: nuvoton: Add driver for WPCM450")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>

Patch applied!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] pinctrl: nuvoton: Fix return value check in wpcm450_gpio_register()
@ 2022-03-24  0:39   ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2022-03-24  0:39 UTC (permalink / raw)
  To: Jialin Zhang; +Cc: linux-gpio, openbmc, j.neuschaefer, linux-kernel

On Thu, Mar 17, 2022 at 7:49 AM Jialin Zhang <zhangjialin11@huawei.com> wrote:

> In case of error, the function devm_platform_ioremap_resource()
> returns ERR_PTR() and never returns NULL. The NULL test in the
> return value check should be replaced with IS_ERR().
>
> Fixes: a1d1e0e3d80a ("pinctrl: nuvoton: Add driver for WPCM450")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>

Patch applied!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-24  0:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-17  6:58 [PATCH -next] pinctrl: nuvoton: Fix return value check in wpcm450_gpio_register() Jialin Zhang
2022-03-17  6:58 ` Jialin Zhang
2022-03-17 11:24 ` Jonathan Neuschäfer
2022-03-17 11:24   ` Jonathan Neuschäfer
2022-03-24  0:39 ` Linus Walleij
2022-03-24  0:39   ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.