2020-04-24 13:48:59

by Zou Wei

[permalink] [raw]
Subject: [PATCH -next] net/mlx4_core: Add missing iounmap() in error path

This fixes the following coccicheck warning:

drivers/net/ethernet/mellanox/mlx4/crdump.c:200:2-8: ERROR: missing iounmap;
ioremap on line 190 and execution via conditional on line 198

Fixes: 7ef19d3b1d5e ("devlink: report error once U32_MAX snapshot ids have been used")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Zou Wei <[email protected]>
---
drivers/net/ethernet/mellanox/mlx4/crdump.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlx4/crdump.c b/drivers/net/ethernet/mellanox/mlx4/crdump.c
index 73eae80e..ac5468b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/crdump.c
+++ b/drivers/net/ethernet/mellanox/mlx4/crdump.c
@@ -197,6 +197,7 @@ int mlx4_crdump_collect(struct mlx4_dev *dev)
err = devlink_region_snapshot_id_get(devlink, &id);
if (err) {
mlx4_err(dev, "crdump: devlink get snapshot id err %d\n", err);
+ iounmap(cr_space);
return err;
}

--
2.6.2


2020-04-24 19:50:34

by Saeed Mahameed

[permalink] [raw]
Subject: Re: [PATCH -next] net/mlx4_core: Add missing iounmap() in error path

On Fri, 2020-04-24 at 21:53 +0800, Zou Wei wrote:
> This fixes the following coccicheck warning:
>
> drivers/net/ethernet/mellanox/mlx4/crdump.c:200:2-8: ERROR: missing
> iounmap;
> ioremap on line 190 and execution via conditional on line 198
>
> Fixes: 7ef19d3b1d5e ("devlink: report error once U32_MAX snapshot ids
> have been used")
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Zou Wei <[email protected]>
> ---
> drivers/net/ethernet/mellanox/mlx4/crdump.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/crdump.c
> b/drivers/net/ethernet/mellanox/mlx4/crdump.c
> index 73eae80e..ac5468b 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/crdump.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/crdump.c
> @@ -197,6 +197,7 @@ int mlx4_crdump_collect(struct mlx4_dev *dev)
> err = devlink_region_snapshot_id_get(devlink, &id);
> if (err) {
> mlx4_err(dev, "crdump: devlink get snapshot id err
> %d\n", err);
> + iounmap(cr_space);
> return err;
> }
>

Reviewed-by: Saeed Mahameed <[email protected]>

2020-04-26 03:46:17

by David Miller

[permalink] [raw]
Subject: Re: [PATCH -next] net/mlx4_core: Add missing iounmap() in error path

From: Zou Wei <[email protected]>
Date: Fri, 24 Apr 2020 21:53:14 +0800

> This fixes the following coccicheck warning:
>
> drivers/net/ethernet/mellanox/mlx4/crdump.c:200:2-8: ERROR: missing iounmap;
> ioremap on line 190 and execution via conditional on line 198
>
> Fixes: 7ef19d3b1d5e ("devlink: report error once U32_MAX snapshot ids have been used")
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Zou Wei <[email protected]>

Applied.