Skip to content

Commit

Permalink
net/ieee80211: adjust error handling
Browse files Browse the repository at this point in the history
Converts a test in error handling code to a sequence of labels.

The semantic match that found the problem is:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
expression E,E1,E2;
@@

E = alloc_etherdev(...)
... when != E = E1
if (...) { ... free_netdev(E); ... return ...; }
... when != E = E2
(
  if (...)
   {
   ... when != free_netdev(E);
   return dev; }
|
* if (...)
   {
   ... when != free_netdev(E);
   return ...; }
|
register_netdev(E)
)

// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Julia Lawall authored and John W. Linville committed Aug 22, 2008
1 parent 1ff41eb commit d92a8e8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/ieee80211/ieee80211_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
err = ieee80211_networks_allocate(ieee);
if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n", err);
goto failed;
goto failed_free_netdev;
}
ieee80211_networks_initialize(ieee);

Expand Down Expand Up @@ -193,9 +193,9 @@ struct net_device *alloc_ieee80211(int sizeof_priv)

return dev;

failed:
if (dev)
free_netdev(dev);
failed_free_netdev:
free_netdev(dev);
failed:
return NULL;
}

Expand Down

0 comments on commit d92a8e8

Please sign in to comment.