diff mbox series

[-next,v2] net: pcs-rzn1-miic: fix return value check in miic_probe()

Message ID 20220628131259.3109124-1-yangyingliang@huawei.com (mailing list archive)
State Accepted
Commit dbc6fc7e3f76ac8a584cd39f9978d6b41a96e75a
Delegated to: Netdev Maintainers
Headers show
Series [-next,v2] net: pcs-rzn1-miic: fix return value check in miic_probe() | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 6 maintainers not CCed: linux@armlinux.org.uk hkallweit1@gmail.com pabeni@redhat.com kuba@kernel.org edumazet@google.com andrew@lunn.ch
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yang Yingliang June 28, 2022, 1:12 p.m. UTC
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(-)

Comments

Clément Léger June 29, 2022, 9:15 a.m. UTC | #1
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>
patchwork-bot+netdevbpf@kernel.org June 30, 2022, 4:10 a.m. UTC | #2
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!
diff mbox series

Patch

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)