Patchwork cfi.h: quiet sparse noise

login
register
mail settings
Submitter hartleys
Date Jan. 15, 2010, 6:09 p.m.
Message ID <201001151109.32890.hartleys@visionengravers.com>
Download mbox | patch
Permalink /patch/42984/
State New
Headers show

Comments

hartleys - Jan. 15, 2010, 6:09 p.m.
cfi.h: quiet sparse noise

In the inline function cfi_build_cmd_addr, the cast of cmd_ofs to an
uint8_t produces a sparse warning of the type:

warning: cast truncates bits from constant value (2aa becomes aa)

Quiet the warning by masking cmd_ofs with 0xff and remove the cast.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Woodhouse <dwmw2@infradead.org>

---
Artem Bityutskiy - Feb. 2, 2010, 5:58 a.m.
On Fri, 2010-01-15 at 11:09 -0700, H Hartley Sweeten wrote:
> cfi.h: quiet sparse noise
> 
> In the inline function cfi_build_cmd_addr, the cast of cmd_ofs to an
> uint8_t produces a sparse warning of the type:
> 
> warning: cast truncates bits from constant value (2aa becomes aa)
> 
> Quiet the warning by masking cmd_ofs with 0xff and remove the cast.
> 
> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
> Cc: David Woodhouse <dwmw2@infradead.org>

Pushed this one to my l2-mtd-2.6 / master

Patch

diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index df89f42..a4eefc5 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -297,7 +297,7 @@  static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs,
 	 * and 32bit devices on 16 bit busses
 	 * set the low bit of the alternating bit sequence of the address.
 	 */
-	if (((type * interleave) > bankwidth) && ((uint8_t)cmd_ofs == 0xaa))
+	if (((type * interleave) > bankwidth) && ((cmd_ofs & 0xff) == 0xaa))
 		addr |= (type >> 1)*interleave;
 
 	return  addr;