Skip to content

Commit

Permalink
bnx2: Close device if MTU change or ring size change fails.
Browse files Browse the repository at this point in the history
When unable to allocate memory for new MTU or new ring size, we need
to close the device to prevent it from crashing.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Michael Chan authored and David S. Miller committed Aug 23, 2009
1 parent 3767546 commit 6fefb65
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/net/bnx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -6992,9 +6992,14 @@ bnx2_change_ring_size(struct bnx2 *bp, u32 rx, u32 tx)
int rc;

rc = bnx2_alloc_mem(bp);
if (rc)
if (!rc)
rc = bnx2_init_nic(bp, 0);

if (rc) {
bnx2_napi_enable(bp);
dev_close(bp->dev);
return rc;
bnx2_init_nic(bp, 0);
}
bnx2_netif_start(bp);
}
return 0;
Expand Down

0 comments on commit 6fefb65

Please sign in to comment.