Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] libertas: remove two libertas sparse warning
@ 2008-10-29  9:35 Holger Schurig
  2008-10-29 10:17 ` Dan Williams
  0 siblings, 1 reply; 2+ messages in thread
From: Holger Schurig @ 2008-10-29  9:35 UTC (permalink / raw)
  To: linux-wireless

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.

Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>


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

Index: linux-wl/drivers/net/wireless/libertas/cmd.c
===================================================================
--- linux-wl.orig/drivers/net/wireless/libertas/cmd.c	2008-10-29 08:22:28.000000000 +0100
+++ linux-wl/drivers/net/wireless/libertas/cmd.c	2008-10-29 08:22:36.000000000 +0100
@@ -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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libertas: remove two libertas sparse warning
  2008-10-29  9:35 [PATCH] libertas: remove two libertas sparse warning Holger Schurig
@ 2008-10-29 10:17 ` Dan Williams
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2008-10-29 10:17 UTC (permalink / raw)
  To: Holger Schurig; +Cc: linux-wireless

On Wed, 2008-10-29 at 10:35 +0100, Holger Schurig wrote:
> 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.
> 
> Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>

Acked-by: Dan Williams <dcbw@redhat.com>

> 
> ---
> Sent this to Linville, johill and Dan, but forgot the mailing list ;-/
> 
> Index: linux-wl/drivers/net/wireless/libertas/cmd.c
> ===================================================================
> --- linux-wl.orig/drivers/net/wireless/libertas/cmd.c	2008-10-29 08:22:28.000000000 +0100
> +++ linux-wl/drivers/net/wireless/libertas/cmd.c	2008-10-29 08:22:36.000000000 +0100
> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-29 10:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-29  9:35 [PATCH] libertas: remove two libertas sparse warning Holger Schurig
2008-10-29 10:17 ` Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox