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 Closes: https://lore.kernel.org/linux-rdma/aMQWenzpdjhAX4fm@stanley.mountain/ Signed-off-by: Vlad Dumitrescu --- .../net/ethernet/mellanox/mlx5/core/lib/nv_param.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/nv_param.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/nv_param.c index 383d8cfe4c0a..459a0b4d08e6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/nv_param.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/nv_param.c @@ -458,7 +458,6 @@ static int mlx5_devlink_total_vfs_set(struct devlink *devlink, u32 id, { struct mlx5_core_dev *dev = devlink_priv(devlink); u32 mnvda[MLX5_ST_SZ_DW(mnvda_reg)]; - bool per_pf_support; void *data; int err; @@ -474,9 +473,7 @@ static int mlx5_devlink_total_vfs_set(struct devlink *devlink, u32 id, return -EOPNOTSUPP; } - per_pf_support = MLX5_GET(nv_global_pci_cap, data, - per_pf_total_vf_supported); - if (!per_pf_support) { + if (!MLX5_GET(nv_global_pci_cap, data, per_pf_total_vf_supported)) { /* We don't allow global SRIOV setting on per PF devlink */ NL_SET_ERR_MSG_MOD(extack, "SRIOV is not per PF on this device"); @@ -489,14 +486,8 @@ static int mlx5_devlink_total_vfs_set(struct devlink *devlink, u32 id, return err; MLX5_SET(nv_global_pci_conf, data, sriov_valid, 1); - MLX5_SET(nv_global_pci_conf, data, per_pf_total_vf, per_pf_support); - - if (!per_pf_support) { - MLX5_SET(nv_global_pci_conf, data, total_vfs, ctx->val.vu32); - return mlx5_nv_param_write(dev, mnvda, sizeof(mnvda)); - } + MLX5_SET(nv_global_pci_conf, data, per_pf_total_vf, 1); - /* SRIOV is per PF */ err = mlx5_nv_param_write(dev, mnvda, sizeof(mnvda)); if (err) return err; -- 2.49.0