Skip to contentSkip to conversation

mlx4: Fix missing error code in mlx4_load_one()

PATCH Applied Jiapeng Chong 4 participants 4 messages Jul 23, 2021 – Jul 25, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mlx4: Fix missing error code in mlx4_load_one()

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

Fixes 7ae0e400cd93 ("net/mlx4_core: Flexible (asymmetric) allocation of

EQs and MSI-X vectors for PF/VFs")

---
 drivers/net/ethernet/mellanox/mlx4/main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx4/main.c +1 -0
index 00c8465..28ac469 100644
@@ -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;
 		}
 	}
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 22 lines · Jiapeng Chong

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

Fixes 7ae0e400cd93 ("net/mlx4_core: Flexible (asymmetric) allocation of

EQs and MSI-X vectors for PF/VFs")

---
  drivers/net/ethernet/mellanox/mlx4/main.c | 1 +
  1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx4/main.c +0 -0
index 00c8465..28ac469 100644

drivers/net/ethernet/mellanox/mlx4/main.c static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data, · line 3541

Quoted 7 lines
drivers/net/ethernet/mellanox/mlx4/main.c +1 -0
@@ -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.

Regards,
Tariq

#2 lore raw
In reply to Jiapeng Chong
Quoted 11 lines · Jiapeng Chong

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

Fixes 7ae0e400cd93 ("net/mlx4_core: Flexible (asymmetric) allocation of

EQs and MSI-X vectors for PF/VFs")

Fixes line shouldn't be wrapped.

Quoted 11 lines
---
 drivers/net/ethernet/mellanox/mlx4/main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx4/main.c +0 -0
index 00c8465..28ac469 100644

drivers/net/ethernet/mellanox/mlx4/main.c static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data, · line 3541

Quoted 7 lines
drivers/net/ethernet/mellanox/mlx4/main.c +1 -0
@@ -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

#3 lore raw
In reply to Jiapeng Chong
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

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

Quoted 9 lines · 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