Skip to contentSkip to conversation

net/ieee80211: adjust error handling

PATCH In review [email protected] 1 participant 1 message Jul 30, 2008 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 net/ieee80211: adjust error handling

From: Julia Lawall <[email protected]>

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>

Cc James Ketrenos <[email protected]>
Cc John W. Linville <[email protected]>
Cc Jiri Benc <[email protected]>
Cc Zhu Yi <[email protected]>
Cc Larry Finger <[email protected]>

---

 net/ieee80211/ieee80211_module.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
net/ieee80211/ieee80211_module.c renamed from net/ieee80211/ieee80211_module.c~net-ieee80211-adjust-error-handling +4 -4
diff -puN net/ieee80211/ieee80211_module.c~net-ieee80211-adjust-error-handling net/ieee80211/ieee80211_module.c
@@ -157,7 +157,7 @@ struct net_device *alloc_ieee80211(int s
 	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);
 
@@ -193,9 +193,9 @@ struct net_device *alloc_ieee80211(int s
 
 	return dev;
 
-      failed:
-	if (dev)
-		free_netdev(dev);
+failed_free_netdev:
+	free_netdev(dev);
+failed:
 	return NULL;
 }
 

_