Commit 95aac2cd authored by Erez Alfasi's avatar Erez Alfasi Committed by David S. Miller

net/mlx4_core: Fix return codes of unsupported operations

Functions __set_port_type and mlx4_check_port_params returned
-EINVAL while the proper return code is -EOPNOTSUPP as a
result of an unsupported operation. All drivers should generate
this and all users should check for it when detecting an
unsupported functionality.
Signed-off-by: default avatarErez Alfasi <ereza@mellanox.com>
Signed-off-by: default avatarTariq Toukan <tariqt@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 30fcd6a9
...@@ -313,7 +313,7 @@ int mlx4_check_port_params(struct mlx4_dev *dev, ...@@ -313,7 +313,7 @@ int mlx4_check_port_params(struct mlx4_dev *dev,
for (i = 0; i < dev->caps.num_ports - 1; i++) { for (i = 0; i < dev->caps.num_ports - 1; i++) {
if (port_type[i] != port_type[i + 1]) { if (port_type[i] != port_type[i + 1]) {
mlx4_err(dev, "Only same port types supported on this HCA, aborting\n"); mlx4_err(dev, "Only same port types supported on this HCA, aborting\n");
return -EINVAL; return -EOPNOTSUPP;
} }
} }
} }
...@@ -322,7 +322,7 @@ int mlx4_check_port_params(struct mlx4_dev *dev, ...@@ -322,7 +322,7 @@ int mlx4_check_port_params(struct mlx4_dev *dev,
if (!(port_type[i] & dev->caps.supported_type[i+1])) { if (!(port_type[i] & dev->caps.supported_type[i+1])) {
mlx4_err(dev, "Requested port type for port %d is not supported on this HCA\n", mlx4_err(dev, "Requested port type for port %d is not supported on this HCA\n",
i + 1); i + 1);
return -EINVAL; return -EOPNOTSUPP;
} }
} }
return 0; return 0;
...@@ -1188,8 +1188,7 @@ static int __set_port_type(struct mlx4_port_info *info, ...@@ -1188,8 +1188,7 @@ static int __set_port_type(struct mlx4_port_info *info,
mlx4_err(mdev, mlx4_err(mdev,
"Requested port type for port %d is not supported on this HCA\n", "Requested port type for port %d is not supported on this HCA\n",
info->port); info->port);
err = -EINVAL; return -EOPNOTSUPP;
goto err_sup;
} }
mlx4_stop_sense(mdev); mlx4_stop_sense(mdev);
...@@ -1211,7 +1210,7 @@ static int __set_port_type(struct mlx4_port_info *info, ...@@ -1211,7 +1210,7 @@ static int __set_port_type(struct mlx4_port_info *info,
for (i = 1; i <= mdev->caps.num_ports; i++) { for (i = 1; i <= mdev->caps.num_ports; i++) {
if (mdev->caps.possible_type[i] == MLX4_PORT_TYPE_AUTO) { if (mdev->caps.possible_type[i] == MLX4_PORT_TYPE_AUTO) {
mdev->caps.possible_type[i] = mdev->caps.port_type[i]; mdev->caps.possible_type[i] = mdev->caps.port_type[i];
err = -EINVAL; err = -EOPNOTSUPP;
} }
} }
} }
...@@ -1237,7 +1236,7 @@ static int __set_port_type(struct mlx4_port_info *info, ...@@ -1237,7 +1236,7 @@ static int __set_port_type(struct mlx4_port_info *info,
out: out:
mlx4_start_sense(mdev); mlx4_start_sense(mdev);
mutex_unlock(&priv->port_mutex); mutex_unlock(&priv->port_mutex);
err_sup:
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment