Commit c928febf authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller

starfire: clean up properly if firmware loading fails

netdev_open() will return without cleaning up net device or hardware state
if firmware loading fails.  This results in a BUG() on a second attempt to
bring the interface up, reported in
<http://bugzilla.kernel.org/show_bug.cgi?id=15091>, and probably has even
worse effects if the driver is removed afterwards.

Call netdev_close() to clean up on failure.

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=15091Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
Reported-by: default avatarMichael Moffatt <michael@moffatt.org.nz>
Tested-by: default avatarMichael Moffatt <michael@moffatt.org.nz>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c92b544b
...@@ -1063,7 +1063,7 @@ static int netdev_open(struct net_device *dev) ...@@ -1063,7 +1063,7 @@ static int netdev_open(struct net_device *dev)
if (retval) { if (retval) {
printk(KERN_ERR "starfire: Failed to load firmware \"%s\"\n", printk(KERN_ERR "starfire: Failed to load firmware \"%s\"\n",
FIRMWARE_RX); FIRMWARE_RX);
return retval; goto out_init;
} }
if (fw_rx->size % 4) { if (fw_rx->size % 4) {
printk(KERN_ERR "starfire: bogus length %zu in \"%s\"\n", printk(KERN_ERR "starfire: bogus length %zu in \"%s\"\n",
...@@ -1108,6 +1108,9 @@ out_tx: ...@@ -1108,6 +1108,9 @@ out_tx:
release_firmware(fw_tx); release_firmware(fw_tx);
out_rx: out_rx:
release_firmware(fw_rx); release_firmware(fw_rx);
out_init:
if (retval)
netdev_close(dev);
return retval; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment