Subject: [PATCH] atmel: unregister_netdev() on error

From: Kulikov Vasiliy <[email-masked]>
Date: Sat, 10 Jul 2010 17:11:47 +0400

We must unregister registered device if probe_atmel_card() fails.

Signed-off-by: Kulikov Vasiliy <[email-masked]>
---
 drivers/net/wireless/atmel.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index c8f7090..b9334a3 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -1626,7 +1626,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port,
 
 	if (!probe_atmel_card(dev)) {
 		unregister_netdev(dev);
-		goto err_out_res;
+		goto err_out_unreg;
 	}
 
 	netif_carrier_off(dev);
@@ -1640,6 +1640,9 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port,
 
 	return dev;
 
+err_out_unreg:
+	unregister_netdev(dev);
+
 err_out_res:
 	release_region(dev->base_addr, 32);
 err_out_irq:
-- 
1.7.0.4