Skip to contentSkip to conversation

hostap: fix an error code in prism2_config()

PATCH Applied Dan Carpenter 2 participants 2 messages Dec 4, 2015 – Dec 11, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hostap: fix an error code in prism2_config()

The current code returns success if prism2_init_local_data() fails, but we want to return an error code. Also we can remove the bogus ret initializer because it is wrong and never used.

drivers/net/wireless/intersil/hostap/hostap_cs.c +4 -2
index 50033aa..74f63b7 100644
@@ -473,7 +473,7 @@ static int prism2_config(struct pcmcia_device *link)
 	struct net_device *dev;
 	struct hostap_interface *iface;
 	local_info_t *local;
-	int ret = 1;
+	int ret;
 	struct hostap_cs_priv *hw_priv;
 	unsigned long flags;
 
@@ -502,8 +502,10 @@ static int prism2_config(struct pcmcia_device *link)
 	/* Need to allocate net_device before requesting IRQ handler */
 	dev = prism2_init_local_data(&prism2_pccard_funcs, 0,
 				     &link->dev);
-	if (dev = NULL)
+	if (!dev) {
+		ret = -ENOMEM;
 		goto failed;
+	}
 	link->priv = dev;
 
 	iface = netdev_priv(dev);
Applied
#1 lore raw
Quoted 6 lines

The current code returns success if prism2_init_local_data() fails, but we want to return an error code. Also we can remove the bogus ret initializer because it is wrong and never used.

Thanks, applied to wireless-drivers-next.git.

Kalle Valo