bnx2x: fix memory leak in bnx2x_init_firmware()
authorMichal Schmidt <mschmidt@redhat.com>
Thu, 15 Mar 2012 14:08:29 +0000 (14:08 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Mar 2012 08:57:26 +0000 (01:57 -0700)
commitc0ea452e422a1fc78ec8c639df64012d0b8dbb4a
tree372e3246e5f51cf490a760e1d49de60263d53d2e
parent127d0a198a310970b31866af8bbb6d4b1068e546
bnx2x: fix memory leak in bnx2x_init_firmware()

When cycling the interface down and up, bnx2x_init_firmware() knows that
the firmware is already loaded, but nevertheless it allocates certain
arrays anew (init_data, init_ops, init_ops_offsets, iro_arr). The old
arrays are leaked.

Fix the leaks by returning early if the firmware was already loaded.
Because if the firmware is loaded, so are the arrays.

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c