Skip to contentSkip to conversation

hostap_hw.c:hfa384x_set_rid(): fix error handling

RFC PATCH In review Adrian Bunk 2 participants 2 messages Mar 9, 2006 – Mar 13, 2006

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

RFC PATCH 1/1 hostap_hw.c:hfa384x_set_rid(): fix error handling

The Coverity checker noted that the call to prism2_hw_reset() was dead code.

Does this patch change the code to what was intended?

drivers/net/wireless/hostap/hostap_hw.c renamed from drivers/net/wireless/hostap/hostap_hw.c.old +4 -4
@@ -928,16 +928,16 @@ static int hfa384x_set_rid(struct net_de
 
 	res = hfa384x_cmd(dev, HFA384X_CMDCODE_ACCESS_WRITE, rid, NULL, NULL);
 	up(&local->rid_bap_sem);
+
 	if (res) {
+		if (res == -ETIMEDOUT)
+			prism2_hw_reset(dev);
+
 		printk(KERN_DEBUG "%s: hfa384x_set_rid: CMDCODE_ACCESS_WRITE "
 		       "failed (res=%d, rid=%04x, len=%d)\n",
 		       dev->name, res, rid, len);
-		return res;
 	}
 
-	if (res == -ETIMEDOUT)
-		prism2_hw_reset(dev);
-
 	return res;
 }
 
#1 lore raw
Quoted 4 lines · Adrian Bunk

The Coverity checker noted that the call to prism2_hw_reset() was dead code.

Does this patch change the code to what was intended?

Thanks! Based on my CVS history, it looks like this was broken in 2002 when the access command was moved from another function and verification of -ETIMEDOUT value was not moved correctly. The original behavior would be achieved by changing your patch to call printk first before the moved prism2_hw_reset(dev) call. I added this (with the re-ordered printk) to my queue for wireless-2.6.

Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA