[PATCH 3/3] staging/keucr: eliminate sparse warnings in ms.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Randy Dunlap <randy.dunlap@xxxxxxxxxx>

Eliminate sparse warnings in ms.c:

drivers/staging/keucr/ms.c:28:58: warning: right shift by bigger than source value
drivers/staging/keucr/ms.c:31:58: warning: right shift by bigger than source value
drivers/staging/keucr/ms.c:789:59: warning: cast truncates bits from constant value (ffffff7f becomes 7f)

Signed-off-by: Randy Dunlap <randy.dunlap@xxxxxxxxxx>
---
 drivers/staging/keucr/common.h |    2 ++
 drivers/staging/keucr/ms.c     |    7 ++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

--- linux-next-20110506.orig/drivers/staging/keucr/ms.c
+++ linux-next-20110506/drivers/staging/keucr/ms.c
@@ -25,10 +25,10 @@ int MS_ReaderCopyBlock(struct us_data *u
 	bcb->CDB[1]			= 0x08;
 	bcb->CDB[4]			= (BYTE)(oldphy);
 	bcb->CDB[3]			= (BYTE)(oldphy>>8);
-	bcb->CDB[2]			= (BYTE)(oldphy>>16);
+	bcb->CDB[2]			= 0; /* (BYTE)(oldphy>>16) */
 	bcb->CDB[7]			= (BYTE)(newphy);
 	bcb->CDB[6]			= (BYTE)(newphy>>8);
-	bcb->CDB[5]			= (BYTE)(newphy>>16);
+	bcb->CDB[5]			= 0; /* (BYTE)(newphy>>16) */
 	bcb->CDB[9]			= (BYTE)(PhyBlockAddr);
 	bcb->CDB[8]			= (BYTE)(PhyBlockAddr>>8);
 	bcb->CDB[10]		= PageNum;
@@ -786,7 +786,8 @@ int MS_LibErrorPhyBlock(struct us_data *
     MS_LibSetAcquiredErrorBlock(us, phyblk);
 
     if (MS_LibIsWritable(us))
-        return MS_LibOverwriteExtra(us, phyblk, 0, (BYTE)(~MS_REG_OVR_BKST));
+        return MS_LibOverwriteExtra(us, phyblk, 0,
+				(BYTE)(~MS_REG_OVR_BKST & BYTE_MASK));
 
 
     return MS_STATUS_SUCCESS;
--- linux-next-20110506.orig/drivers/staging/keucr/common.h
+++ linux-next-20110506/drivers/staging/keucr/common.h
@@ -9,5 +9,7 @@ typedef u16 *PWORD;
 typedef u32 DWORD;
 typedef u32 *PDWORD;
 
+#define BYTE_MASK	0xff
+
 #endif
 
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux