diff mbox

[OPW,kernel] staging:rtl8187se: Fix sparse warning in right shift

Message ID 20140312182300.GA12815@himangi-Inspiron-N5110gmail.com
State New, archived
Headers show

Commit Message

HIMANGI SARAOGI March 12, 2014, 6:23 p.m. UTC
This patch fixes the following sparse warning:
drivers/staging/rtl8187se/r8180_core.c:1328:40: warning: right shift by bigger than source value

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
---
 drivers/staging/rtl8187se/r8180_core.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Bob Copeland March 12, 2014, 6:30 p.m. UTC | #1
On Wed, Mar 12, 2014 at 11:53:00PM +0530, Himangi Saraogi wrote:
> -		signal = (unsigned char)(*(priv->rxringtail + 3) &
> -			0x00ff0000) >> 16;
> +		signal = 0;

The real issue here seems to be missing parenthesis - the
cast has higher precedence than the right shift.

>  		signal = (signal & 0xfe) >> 1;

(you could combine this shift in with the other one...)

>  
>  		quality = (unsigned char)((*(priv->rxringtail+3)) & (0xff));

Note how there's extra parens here?
diff mbox

Patch

diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
index 396c713..439c1bf 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -1324,8 +1324,7 @@  static void rtl8180_rx(struct net_device *dev)
 			priv->rx_skb_complete = 1;
 		}
 
-		signal = (unsigned char)(*(priv->rxringtail + 3) &
-			0x00ff0000) >> 16;
+		signal = 0;
 		signal = (signal & 0xfe) >> 1;
 
 		quality = (unsigned char)((*(priv->rxringtail+3)) & (0xff));