Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net/mlx5: Remove dead code from total_vfs setter

The mlx5_devlink_total_vfs_set function branches based on per_pf_support
twice. Remove the second branch as the first one exits the function when
per_pf_support is false.

Accidentally added as part of commit a4c49611cf4f ("net/mlx5: Implement
devlink total_vfs parameter").

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-rdma/aMQWenzpdjhAX4fm@stanley.mountain/
Signed-off-by: Vlad Dumitrescu <vdumitrescu@nvidia.com>
Link: https://patch.msgid.link/a6142a60-1948-439a-b0ae-ff1df26a37f8@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Vlad Dumitrescu and committed by
Jakub Kicinski
6a46e4fa 85c7333c

+2 -11
+2 -11
drivers/net/ethernet/mellanox/mlx5/core/lib/nv_param.c
··· 458 458 { 459 459 struct mlx5_core_dev *dev = devlink_priv(devlink); 460 460 u32 mnvda[MLX5_ST_SZ_DW(mnvda_reg)]; 461 - bool per_pf_support; 462 461 void *data; 463 462 int err; 464 463 ··· 473 474 return -EOPNOTSUPP; 474 475 } 475 476 476 - per_pf_support = MLX5_GET(nv_global_pci_cap, data, 477 - per_pf_total_vf_supported); 478 - if (!per_pf_support) { 477 + if (!MLX5_GET(nv_global_pci_cap, data, per_pf_total_vf_supported)) { 479 478 /* We don't allow global SRIOV setting on per PF devlink */ 480 479 NL_SET_ERR_MSG_MOD(extack, 481 480 "SRIOV is not per PF on this device"); ··· 486 489 return err; 487 490 488 491 MLX5_SET(nv_global_pci_conf, data, sriov_valid, 1); 489 - MLX5_SET(nv_global_pci_conf, data, per_pf_total_vf, per_pf_support); 492 + MLX5_SET(nv_global_pci_conf, data, per_pf_total_vf, 1); 490 493 491 - if (!per_pf_support) { 492 - MLX5_SET(nv_global_pci_conf, data, total_vfs, ctx->val.vu32); 493 - return mlx5_nv_param_write(dev, mnvda, sizeof(mnvda)); 494 - } 495 - 496 - /* SRIOV is per PF */ 497 494 err = mlx5_nv_param_write(dev, mnvda, sizeof(mnvda)); 498 495 if (err) 499 496 return err;