]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/mlx5e: mlx5e_fec_in_caps() returns a boolean
authorSaeed Mahameed <saeedm@nvidia.com>
Fri, 11 Sep 2020 18:00:06 +0000 (11:00 -0700)
committerSaeed Mahameed <saeedm@nvidia.com>
Tue, 22 Sep 2020 00:22:25 +0000 (17:22 -0700)
Returning errno is a bug, fix that.

Also fixes smatch warnings:
drivers/net/ethernet/mellanox/mlx5/core/en/port.c:453
mlx5e_fec_in_caps() warn: signedness bug returning '(-95)'

Fixes: 311f5799562b ("net/mlx5e: Advertise globaly supported FEC modes")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Aya Levin <ayal@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/port.c

index 5de1cb9f53308c1dfa7a89ea897b314b1e25e6eb..96608dbb9314b125d63bd6e4a9dcc10df30c3684 100644 (file)
@@ -490,11 +490,8 @@ bool mlx5e_fec_in_caps(struct mlx5_core_dev *dev, int fec_policy)
        int err;
        int i;
 
-       if (!MLX5_CAP_GEN(dev, pcam_reg))
-               return -EOPNOTSUPP;
-
-       if (!MLX5_CAP_PCAM_REG(dev, pplm))
-               return -EOPNOTSUPP;
+       if (!MLX5_CAP_GEN(dev, pcam_reg) || !MLX5_CAP_PCAM_REG(dev, pplm))
+               return false;
 
        MLX5_SET(pplm_reg, in, local_port, 1);
        err =  mlx5_core_access_reg(dev, in, sz, out, sz, MLX5_REG_PPLM, 0, 0);