diff options
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/lib/hv.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/hv.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/hv.c index cf08d02703fb..583dc7e2aca8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/hv.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/hv.c @@ -12,7 +12,7 @@ static int mlx5_hv_config_common(struct mlx5_core_dev *dev, void *buf, int len, int bytes_returned; int block_id; - if (offset % HV_CONFIG_BLOCK_SIZE_MAX || len % HV_CONFIG_BLOCK_SIZE_MAX) + if (offset % HV_CONFIG_BLOCK_SIZE_MAX || len != HV_CONFIG_BLOCK_SIZE_MAX) return -EINVAL; block_id = offset / HV_CONFIG_BLOCK_SIZE_MAX; @@ -25,8 +25,8 @@ static int mlx5_hv_config_common(struct mlx5_core_dev *dev, void *buf, int len, HV_CONFIG_BLOCK_SIZE_MAX, block_id); /* Make sure len bytes were read successfully */ - if (read) - rc |= !(len == bytes_returned); + if (read && !rc && len != bytes_returned) + rc = -EIO; if (rc) { mlx5_core_err(dev, "Failed to %s hv config, err = %d, len = %d, offset = %d\n", |