Skip to content

Commit

Permalink
libertas: harden-up exit paths
Browse files Browse the repository at this point in the history
These simple sanity check avoids extra complexity in error paths when
moving to asynchronous firmware loading (which means the device may fail to
init some time after its creation).

Signed-off-by: Daniel Drake <[email protected]>
Acked-by: Dan Williams <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
  • Loading branch information
Daniel Drake authored and linvjw committed Apr 17, 2012
1 parent 370803c commit 0beecac
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/net/wireless/libertas/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,9 @@ void lbs_remove_card(struct lbs_private *priv)
lbs_deb_enter(LBS_DEB_MAIN);

lbs_remove_mesh(priv);
lbs_scan_deinit(priv);

if (priv->wiphy_registered)
lbs_scan_deinit(priv);

/* worker thread destruction blocks on the in-flight command which
* should have been cleared already in lbs_stop_card().
Expand Down Expand Up @@ -1128,6 +1130,11 @@ void lbs_stop_card(struct lbs_private *priv)
goto out;
dev = priv->dev;

/* If the netdev isn't registered, it means that lbs_start_card() was
* never called so we have nothing to do here. */
if (dev->reg_state != NETREG_REGISTERED)
goto out;

netif_stop_queue(dev);
netif_carrier_off(dev);

Expand Down

0 comments on commit 0beecac

Please sign in to comment.