Commit 49d74d70 authored by Himangi Saraogi's avatar Himangi Saraogi Committed by Greg Kroah-Hartman

Staging: rtl8192e: adjust error handling

This patch removes a test in error handling code by adding a return
path.

The Coccinelle semantic match that found the problem is:

// <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: default avatarHimangi Saraogi <himangi774@gmail.com>
Acked-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a90c6d53
......@@ -111,7 +111,7 @@ struct net_device *alloc_rtllib(int sizeof_priv)
dev = alloc_etherdev(sizeof(struct rtllib_device) + sizeof_priv);
if (!dev) {
RTLLIB_ERROR("Unable to network device.\n");
goto failed;
return NULL;
}
ieee = (struct rtllib_device *)netdev_priv_rsl(dev);
memset(ieee, 0, sizeof(struct rtllib_device)+sizeof_priv);
......@@ -180,8 +180,7 @@ struct net_device *alloc_rtllib(int sizeof_priv)
return dev;
failed:
if (dev)
free_netdev(dev);
free_netdev(dev);
return NULL;
}
EXPORT_SYMBOL(alloc_rtllib);
......
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