Skip to content

Commit

Permalink
mlx4: fix error path in drivers/net/mlx4/en_rx.c
Browse files Browse the repository at this point in the history
this warning:

  drivers/net/mlx4/en_rx.c: In function ‘mlx4_en_activate_rx_rings’:
  drivers/net/mlx4/en_rx.c:412: warning: ‘err’ may be used uninitialized in this function

Triggers because 'err' is uninitialized in the following input
conditions: priv->rx_ring_num is zero and mlx4_en_fill_rx_buffers()
fails.

But even if ->rx_ring_num is nonzero, 'err' will be zero if
mlx4_en_fill_rx_buffers() fails and mlx4_en_activate_rx_rings() returns
success - incorrectly.

So it's best to keep the error code uptodate on mlx4_en_fill_rx_buffers()
calls as well.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ingo Molnar authored and David S. Miller committed Nov 26, 2008
1 parent 4174439 commit b58515b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/mlx4/en_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,8 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv)
/* Fill Rx buffers */
ring->full = 0;
}
if (mlx4_en_fill_rx_buffers(priv))
err = mlx4_en_fill_rx_buffers(priv);
if (err)
goto err_buffers;

for (ring_ind = 0; ring_ind < priv->rx_ring_num; ring_ind++) {
Expand Down

0 comments on commit b58515b

Please sign in to comment.