[PATCH] mlx4: Fix missing error code in mlx4_load_one()

Subsystems: mellanox mlx4 core vpi driver, networking drivers, the rest

STALE1867d

4 messages, 4 authors, 2021-07-25 · open the first message on its own page

[PATCH] mlx4: Fix missing error code in mlx4_load_one()

From: Jiapeng Chong <hidden>
Date: 2021-07-23 10:36:22

The error code is missing in this code scenario, add the error code
'-EINVAL' to the return value 'err'.

Eliminate the follow smatch warning:

drivers/net/ethernet/mellanox/mlx4/main.c:3538 mlx4_load_one() warn:
missing error code 'err'.

Reported-by: Abaci Robot <redacted>
Fixes: 7ae0e400cd93 ("net/mlx4_core: Flexible (asymmetric) allocation of
EQs and MSI-X vectors for PF/VFs")
Signed-off-by: Jiapeng Chong <redacted>
---
 drivers/net/ethernet/mellanox/mlx4/main.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 00c8465..28ac469 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -3535,6 +3535,7 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data,
 
 		if (!SRIOV_VALID_STATE(dev->flags)) {
 			mlx4_err(dev, "Invalid SRIOV state\n");
+			err = -EINVAL;
 			goto err_close;
 		}
 	}
-- 
1.8.3.1

Re: [PATCH] mlx4: Fix missing error code in mlx4_load_one()

From: Tariq Toukan <hidden>
Date: 2021-07-25 06:15:45


On 7/23/2021 1:36 PM, Jiapeng Chong wrote:
quoted hunk
The error code is missing in this code scenario, add the error code
'-EINVAL' to the return value 'err'.

Eliminate the follow smatch warning:

drivers/net/ethernet/mellanox/mlx4/main.c:3538 mlx4_load_one() warn:
missing error code 'err'.

Reported-by: Abaci Robot <redacted>
Fixes: 7ae0e400cd93 ("net/mlx4_core: Flexible (asymmetric) allocation of
EQs and MSI-X vectors for PF/VFs")
Signed-off-by: Jiapeng Chong <redacted>
---
  drivers/net/ethernet/mellanox/mlx4/main.c | 1 +
  1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 00c8465..28ac469 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -3535,6 +3535,7 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data,
  
  		if (!SRIOV_VALID_STATE(dev->flags)) {
  			mlx4_err(dev, "Invalid SRIOV state\n");
+			err = -EINVAL;
  			goto err_close;
  		}
  	}
Thanks for you patch.
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>

Regards,
Tariq

Re: [PATCH] mlx4: Fix missing error code in mlx4_load_one()

From: Gal Pressman <gal.pressman@linux.dev>
Date: 2021-07-25 08:38:06

On 23/07/2021 13:36, Jiapeng Chong wrote:
The error code is missing in this code scenario, add the error code
'-EINVAL' to the return value 'err'.

Eliminate the follow smatch warning:

drivers/net/ethernet/mellanox/mlx4/main.c:3538 mlx4_load_one() warn:
missing error code 'err'.

Reported-by: Abaci Robot <redacted>
Fixes: 7ae0e400cd93 ("net/mlx4_core: Flexible (asymmetric) allocation of
EQs and MSI-X vectors for PF/VFs")
Fixes line shouldn't be wrapped.
quoted hunk
Signed-off-by: Jiapeng Chong <redacted>
---
 drivers/net/ethernet/mellanox/mlx4/main.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 00c8465..28ac469 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -3535,6 +3535,7 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data,
 
 		if (!SRIOV_VALID_STATE(dev->flags)) {
 			mlx4_err(dev, "Invalid SRIOV state\n");
+			err = -EINVAL;
 			goto err_close;
 		}
 	}
I think this patch is missing a few occurrences:
https://elixir.bootlin.com/linux/v5.14-rc2/source/drivers/net/ethernet/mellanox/mlx4/main.c#L3455
https://elixir.bootlin.com/linux/v5.14-rc2/source/drivers/net/ethernet/mellanox/mlx4/main.c#L3468
https://elixir.bootlin.com/linux/v5.14-rc2/source/drivers/net/ethernet/mellanox/mlx4/main.c#L3490

Re: [PATCH] mlx4: Fix missing error code in mlx4_load_one()

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-07-25 09:50:13

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Fri, 23 Jul 2021 18:36:09 +0800 you wrote:
The error code is missing in this code scenario, add the error code
'-EINVAL' to the return value 'err'.

Eliminate the follow smatch warning:

drivers/net/ethernet/mellanox/mlx4/main.c:3538 mlx4_load_one() warn:
missing error code 'err'.

[...]
Here is the summary with links:
  - mlx4: Fix missing error code in mlx4_load_one()
    https://git.kernel.org/netdev/net/c/7e4960b3d66d

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

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help