Skip to contentSkip to conversation

libertas: remove two libertas sparse warning

PATCH In review Holger Schurig 2 participants 2 messages Oct 29, 2008 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libertas: remove two libertas sparse warning

Johannes Berg detected this two sparse warnings:

drivers/net/wireless/libertas/cmd.c:609:16: warning: cast to restricted __le16 drivers/net/wireless/libertas/cmd.c:611:16: warning: cast to restricted __le16

... but cmd.minlevel is "s8", so we can access it directly and hope for the sign-extension-code in the compiler to convert that to the "s16" type.

---
Sent this to Linville, johill and Dan, but forgot the mailing list ;-/

drivers/net/wireless/libertas/cmd.c +2 -2
Index: linux-wl/drivers/net/wireless/libertas/cmd.c
===================================================================
@@ -606,9 +606,9 @@ int lbs_get_tx_power(struct lbs_private 
 	if (ret == 0) {
 		*curlevel = le16_to_cpu(cmd.curlevel);
 		if (minlevel)
-			*minlevel = le16_to_cpu(cmd.minlevel);
+			*minlevel = cmd.minlevel;
 		if (maxlevel)
-			*maxlevel = le16_to_cpu(cmd.maxlevel);
+			*maxlevel = cmd.maxlevel;
 	}
 
 	lbs_deb_leave(LBS_DEB_CMD);
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Holger Schurig

Johannes Berg detected this two sparse warnings:

drivers/net/wireless/libertas/cmd.c:609:16: warning: cast to restricted __le16 drivers/net/wireless/libertas/cmd.c:611:16: warning: cast to restricted __le16

... but cmd.minlevel is "s8", so we can access it directly and hope for the sign-extension-code in the compiler to convert that to the "s16" type.

Quoted 24 lines

---
Sent this to Linville, johill and Dan, but forgot the mailing list ;-/

Index: linux-wl/drivers/net/wireless/libertas/cmd.c
===================================================================

drivers/net/wireless/libertas/cmd.c +2 -3
@@ -606,9 +606,9 @@ int lbs_get_tx_power(struct lbs_private 
 	if (ret == 0) {
 		*curlevel = le16_to_cpu(cmd.curlevel);
 		if (minlevel)
-			*minlevel = le16_to_cpu(cmd.minlevel);
+			*minlevel = cmd.minlevel;
 		if (maxlevel)
-			*maxlevel = le16_to_cpu(cmd.maxlevel);
+			*maxlevel = cmd.maxlevel;
 	}
 
 	lbs_deb_leave(LBS_DEB_CMD);
--

To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html