Skip to content

Commit

Permalink
net/mlx4_en: Remove unnecessary checks when setting num channels
Browse files Browse the repository at this point in the history
Boundaries checks for the number of RX, TX, other and combined channels
should be checked by the caller and not in the driver.

In addition, remove wrong memset on get channels as it overrides the cmd
field in the requester struct.

Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eran Ben Elisha authored and David S. Miller committed Jan 18, 2017
1 parent 31a86d1 commit e91ef71
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1732,8 +1732,6 @@ static void mlx4_en_get_channels(struct net_device *dev,
{
struct mlx4_en_priv *priv = netdev_priv(dev);

memset(channel, 0, sizeof(*channel));

channel->max_rx = MAX_RX_RINGS;
channel->max_tx = MLX4_EN_MAX_TX_RING_P_UP;

Expand All @@ -1752,10 +1750,7 @@ static int mlx4_en_set_channels(struct net_device *dev,
int xdp_count;
int err = 0;

if (channel->other_count || channel->combined_count ||
channel->tx_count > MLX4_EN_MAX_TX_RING_P_UP ||
channel->rx_count > MAX_RX_RINGS ||
!channel->tx_count || !channel->rx_count)
if (!channel->tx_count || !channel->rx_count)
return -EINVAL;

tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
Expand Down

0 comments on commit e91ef71

Please sign in to comment.