linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next v2] net: pcs-rzn1-miic: fix return value check in miic_probe()
@ 2022-06-28 13:12 Yang Yingliang
  2022-06-29  9:15 ` Clément Léger
  2022-06-30  4:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Yang Yingliang @ 2022-06-28 13:12 UTC (permalink / raw)
  To: linux-kernel, netdev, linux-renesas-soc
  Cc: clement.leger, olteanv, f.fainelli, davem

On failure, devm_platform_ioremap_resource() returns a ERR_PTR() value
and not NULL. Fix return value checking by using IS_ERR() and return
PTR_ERR() as error value.

Fixes: 7dc54d3b8d91 ("net: pcs: add Renesas MII converter driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
v2:
  change commit message as Clément suggested.
---
 drivers/net/pcs/pcs-rzn1-miic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c
index 8f5e910f443d..d896961e48cc 100644
--- a/drivers/net/pcs/pcs-rzn1-miic.c
+++ b/drivers/net/pcs/pcs-rzn1-miic.c
@@ -461,8 +461,8 @@ static int miic_probe(struct platform_device *pdev)
 	spin_lock_init(&miic->lock);
 	miic->dev = dev;
 	miic->base = devm_platform_ioremap_resource(pdev, 0);
-	if (!miic->base)
-		return -EINVAL;
+	if (IS_ERR(miic->base))
+		return PTR_ERR(miic->base);
 
 	ret = devm_pm_runtime_enable(dev);
 	if (ret < 0)
-- 
2.25.1


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

* Re: [PATCH -next v2] net: pcs-rzn1-miic: fix return value check in miic_probe()
  2022-06-28 13:12 [PATCH -next v2] net: pcs-rzn1-miic: fix return value check in miic_probe() Yang Yingliang
@ 2022-06-29  9:15 ` Clément Léger
  2022-06-30  4:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Clément Léger @ 2022-06-29  9:15 UTC (permalink / raw)
  To: Yang Yingliang
  Cc: linux-kernel, netdev, linux-renesas-soc, olteanv, f.fainelli, davem

Le Tue, 28 Jun 2022 21:12:59 +0800,
Yang Yingliang <yangyingliang@huawei.com> a écrit :

> On failure, devm_platform_ioremap_resource() returns a ERR_PTR() value
> and not NULL. Fix return value checking by using IS_ERR() and return
> PTR_ERR() as error value.
> 
> Fixes: 7dc54d3b8d91 ("net: pcs: add Renesas MII converter driver")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> v2:
>   change commit message as Clément suggested.
> ---
>  drivers/net/pcs/pcs-rzn1-miic.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c
> index 8f5e910f443d..d896961e48cc 100644
> --- a/drivers/net/pcs/pcs-rzn1-miic.c
> +++ b/drivers/net/pcs/pcs-rzn1-miic.c
> @@ -461,8 +461,8 @@ static int miic_probe(struct platform_device *pdev)
>  	spin_lock_init(&miic->lock);
>  	miic->dev = dev;
>  	miic->base = devm_platform_ioremap_resource(pdev, 0);
> -	if (!miic->base)
> -		return -EINVAL;
> +	if (IS_ERR(miic->base))
> +		return PTR_ERR(miic->base);
>  
>  	ret = devm_pm_runtime_enable(dev);
>  	if (ret < 0)

LGTM, thanks.

Reviewed-by: Clément Léger <clement.leger@bootlin.com>

-- 
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com

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

* Re: [PATCH -next v2] net: pcs-rzn1-miic: fix return value check in miic_probe()
  2022-06-28 13:12 [PATCH -next v2] net: pcs-rzn1-miic: fix return value check in miic_probe() Yang Yingliang
  2022-06-29  9:15 ` Clément Léger
@ 2022-06-30  4:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-06-30  4:10 UTC (permalink / raw)
  To: Yang Yingliang
  Cc: linux-kernel, netdev, linux-renesas-soc, clement.leger, olteanv,
	f.fainelli, davem

Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 28 Jun 2022 21:12:59 +0800 you wrote:
> On failure, devm_platform_ioremap_resource() returns a ERR_PTR() value
> and not NULL. Fix return value checking by using IS_ERR() and return
> PTR_ERR() as error value.
> 
> Fixes: 7dc54d3b8d91 ("net: pcs: add Renesas MII converter driver")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> 
> [...]

Here is the summary with links:
  - [-next,v2] net: pcs-rzn1-miic: fix return value check in miic_probe()
    https://git.kernel.org/netdev/net-next/c/dbc6fc7e3f76

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-06-30  4:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28 13:12 [PATCH -next v2] net: pcs-rzn1-miic: fix return value check in miic_probe() Yang Yingliang
2022-06-29  9:15 ` Clément Léger
2022-06-30  4:10 ` patchwork-bot+netdevbpf

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).