Skip to content

Commit

Permalink
net/mlx5: FPGA, return -EINVAL if size is zero
Browse files Browse the repository at this point in the history
Currently, if a size of zero is passed to
mlx5_fpga_mem_{read|write}_i2c()
the "err" return value will not be initialized, which triggers gcc
warnings:

[..]/mlx5/core/fpga/sdk.c:87 mlx5_fpga_mem_read_i2c() error:
uninitialized symbol 'err'.
[..]/mlx5/core/fpga/sdk.c:115 mlx5_fpga_mem_write_i2c() error:
uninitialized symbol 'err'.

fix that.

Fixes: a9956d3 ('net/mlx5: FPGA, Add SBU infrastructure')
Signed-off-by: Kamal Heib <kamalh@mellanox.com>
Reviewed-by: Yevgeny Kliteynik <kliteyn@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
  • Loading branch information
Kamal Heib authored and Saeed Mahameed committed Dec 19, 2017
1 parent d03a455 commit bae115a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/fpga/sdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ static int mlx5_fpga_mem_read_i2c(struct mlx5_fpga_device *fdev, size_t size,
u8 actual_size;
int err;

if (!size)
return -EINVAL;

if (!fdev->mdev)
return -ENOTCONN;

Expand Down Expand Up @@ -95,6 +98,9 @@ static int mlx5_fpga_mem_write_i2c(struct mlx5_fpga_device *fdev, size_t size,
u8 actual_size;
int err;

if (!size)
return -EINVAL;

if (!fdev->mdev)
return -ENOTCONN;

Expand Down

0 comments on commit bae115a

Please sign in to comment.