[linux-yocto] [kernel v5.2/standard/xlnx-soc][PATCH 1/2] mtd: spi-nor: change flash_info.flags from u16 to u32 to avoid compile warning

quanyang.wang at windriver.com quanyang.wang at windriver.com
Thu Sep 19 04:58:06 PDT 2019


From: Quanyang Wang <quanyang.wang at windriver.com>

Because SST_GLOBAL_PROT_UNLK is BIT(16) which exceed the extent of
u16, so change it to u32.

drivers/mtd/spi-nor/spi-nor.c:2076:12: warning: large integer implicitly truncated to
unsigned type [-Woverflow]
   .flags = (_flags),
            ^
drivers/mtd/spi-nor/spi-nor.c:2385:19: note: in expansion of macro ‘INFO’
{ "sst26wf016B", INFO(0xbf2651, 0, 64 * 1024, 32, SECT_4K | SST_GLOBAL_PROT_UNLK) },
                   ^~~~

Signed-off-by: Quanyang Wang <quanyang.wang at windriver.com>
---
 drivers/mtd/spi-nor/spi-nor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index d3b287e851cf..0c412b77597a 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -268,7 +268,7 @@ struct flash_info {
 	u16		page_size;
 	u16		addr_width;
 
-	u16		flags;
+	u32		flags;
 #define SECT_4K			BIT(0)	/* SPINOR_OP_BE_4K works uniformly */
 #define SPI_NOR_NO_ERASE	BIT(1)	/* No erase command needed */
 #define SST_WRITE		BIT(2)	/* use SST byte programming */
-- 
2.17.1



More information about the linux-yocto mailing list