From: Michael Chan Date: Fri, 21 Aug 2009 16:20:45 +0000 (+0000) Subject: bnx2: Close device if MTU change or ring size change fails. X-Git-Tag: upstream/snapshot3+hdmi~17671^2~332 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6fefb65e78f098c09d0ab877b2c70421e4c84116;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git bnx2: Close device if MTU change or ring size change fails. 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 9cfd460..1d502e6 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -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;