diff mbox series

[net-next] net: lan966x: fix a IS_ERR() vs NULL check in lan966x_create_targets()

Message ID 20211203095531.GB2480@kili (mailing list archive)
State Accepted
Commit bb14bfc7eb927b47717d82ba7ecc8345d9099cf4
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: lan966x: fix a IS_ERR() vs NULL check in lan966x_create_targets() | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
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 success CCed 5 of 5 maintainers
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/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, 12 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Dan Carpenter Dec. 3, 2021, 9:55 a.m. UTC
The devm_ioremap() function does not return error pointers.  It returns
NULL.

Fixes: db8bcaad5393 ("net: lan966x: add the basic lan966x driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Horatiu Vultur Dec. 3, 2021, 12:53 p.m. UTC | #1
The 12/03/2021 12:55, Dan Carpenter wrote:
> 
> The devm_ioremap() function does not return error pointers.  It returns
> NULL.

Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> 
> Fixes: db8bcaad5393 ("net: lan966x: add the basic lan966x driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> index e9e4dca6542d..00930d81521a 100644
> --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> @@ -83,10 +83,10 @@ static int lan966x_create_targets(struct platform_device *pdev,
>                 begin[idx] = devm_ioremap(&pdev->dev,
>                                           iores[idx]->start,
>                                           resource_size(iores[idx]));
> -               if (IS_ERR(begin[idx])) {
> +               if (!begin[idx]) {
>                         dev_err(&pdev->dev, "Unable to get registers: %s\n",
>                                 iores[idx]->name);
> -                       return PTR_ERR(begin[idx]);
> +                       return -ENOMEM;
>                 }
>         }
> 
> --
> 2.20.1
>
patchwork-bot+netdevbpf@kernel.org Dec. 3, 2021, 2:30 p.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Fri, 3 Dec 2021 12:55:31 +0300 you wrote:
> The devm_ioremap() function does not return error pointers.  It returns
> NULL.
> 
> Fixes: db8bcaad5393 ("net: lan966x: add the basic lan966x driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Here is the summary with links:
  - [net-next] net: lan966x: fix a IS_ERR() vs NULL check in lan966x_create_targets()
    https://git.kernel.org/netdev/net-next/c/bb14bfc7eb92

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
index e9e4dca6542d..00930d81521a 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
@@ -83,10 +83,10 @@  static int lan966x_create_targets(struct platform_device *pdev,
 		begin[idx] = devm_ioremap(&pdev->dev,
 					  iores[idx]->start,
 					  resource_size(iores[idx]));
-		if (IS_ERR(begin[idx])) {
+		if (!begin[idx]) {
 			dev_err(&pdev->dev, "Unable to get registers: %s\n",
 				iores[idx]->name);
-			return PTR_ERR(begin[idx]);
+			return -ENOMEM;
 		}
 	}