spi: cadence_qspi: Fix compilation warning
PATCH 1/1 spi: cadence_qspi: Fix compilation warning
Use "%lu" for size_t data type.
Compilation warning as below:
In file included from include/linux/bug.h:7:0,
from include/common.h:26,
from drivers/spi/cadence_qspi.c:8:drivers/spi/cadence_qspi.c: In function ‘cadence_spi_xfer’:drivers/spi/cadence_qspi.c:211:8: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
debug("%s: len=%d [bytes]\n", __func__, data_bytes);
^
include/linux/printk.h:37:21: note: in definition of macro ‘pr_fmt’
#define pr_fmt(fmt) fmt
^~~include/log.h:142:2: note: in expansion of macro ‘debug_cond’
debug_cond(_DEBUG, fmt, ##args)
^~~~~~~~~~drivers/spi/cadence_qspi.c:211:2: note: in expansion of macro ‘debug’
debug("%s: len=%d [bytes]\n", __func__, data_bytes);
---
v2: use "%lu" instead of cast data type to ulong.
--- drivers/spi/cadence_qspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/cadence_qspi.c +1 -1
@@ -207,7 +207,7 @@ static int cadence_spi_xfer(struct udevice *dev, unsigned int bitlen, }else { data_bytes = bitlen /8 ; } -debug ("%s: len=%d [bytes]\n" , __func__, data_bytes); +debug ("%s: len=%lu [bytes]\n" , __func__, data_bytes);/* Set Chip select */ cadence_qspi_apb_chipselect(base, spi_chip_select(dev),
Signature · 1 line
2.2.2
PATCH 1/1 spi: cadence_qspi: Fix warning cast from pointer to integer of different size
Use "%p" to print cmdbuf.
Compilation warning as below:
CC spl/drivers/spi/cadence_qspi_apb.o
LD spl/lib/built-in.odrivers/spi/cadence_qspi_apb.c: In function ‘cadence_qspi_apb_indirect_write_setup’:drivers/spi/cadence_qspi_apb.c:696:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
cmdlen, (unsigned int)cmdbuf);
---
v2: Use "%p" instead of cast to ulong data type.
--- drivers/spi/cadence_qspi_apb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/cadence_qspi_apb.c +2 -2
@@ -692,8 +692,8 @@ int cadence_qspi_apb_indirect_write_setup(struct cadence_spi_platdata *plat,unsigned int addr_bytes = cmdlen >4 ?4 :3 ;if (cmdlen <4 || cmdbuf ==NULL ) { -printf ("QSPI: iInvalid input argument, len %d cmdbuf 0x%08x\n" , - cmdlen, (unsigned int )cmdbuf); +printf ("QSPI: Invalid input argument, len %d cmdbuf %p\n" , + cmdlen, cmdbuf);return -EINVAL ; }/* Setup the indirect trigger address */
Signature · 1 line
2.2.2
PATCH 1/1 spi: cadence_qspi: Fix warning cast from pointer to integer of different size
Quoted 11 lines · Ley Foon Tan
Use "%p" to print cmdbuf.
Compilation warning as below:
CC
spl/drivers/spi/cadence_qspi_apb.o
LDspl/lib/built-in.odrivers/spi/cadence_qspi_apb.c: In function ‘cadence_qspi_apb_indirect_write_setup’:drivers/spi/cadence_qspi_apb.c:696:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]cmdlen, (unsigned int)cmdbuf);Signed-off-by Ley Foon Tan <[email protected]>
Quoted 22 lines
---
v2: Use "%p" instead of cast to ulong data type.--- drivers/spi/cadence_qspi_apb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/spi/cadence_qspi_apb.c +2
-2@@ -692,8 +692,8 @@ int cadence_qspi_apb_indirect_write_setup(struct cadence_spi_platdata *plat,unsigned int addr_bytes = cmdlen >4 ?4 :3 ;if (cmdlen <4 || cmdbuf ==NULL ) { -printf ("QSPI: iInvalid input argument, len %d cmdbuf 0x%08x\n" , - cmdlen, (unsigned int )cmdbuf); +printf ("QSPI: Invalid input argument, len %d cmdbuf %p\n" , + cmdlen, cmdbuf);return -EINVAL ; }/* Setup the indirect trigger address */
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/1 spi: cadence_qspi: Fix compilation warning
In reply to Ley Foon TanQuoted 14 lines · Ley Foon Tan
Use "%lu" for
size_tdata type.Compilation warning as below:
In file included from
include/linux/bug.h:7:0,
frominclude/common.h:26,
fromdrivers/spi/cadence_qspi.c:8:drivers/spi/cadence_qspi.c: In function ‘cadence_spi_xfer’:drivers/spi/cadence_qspi.c:211:8: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t {aka long unsigned int}’ [-Wformat=]debug("%s: len=%d [bytes]\n", __func__, data_bytes); ^ include/linux/printk.h:37:21: note: in definition of macro ‘pr_fmt’ #define pr_fmt(fmt) fmt ^~~
Quoted 7 lines
include/log.h:142:2: note: in expansion of macro ‘debug_cond’
debug_cond(_DEBUG, fmt, ##args)
^~~~~~~~~~drivers/spi/cadence_qspi.c:211:2: note: in expansion of macro ‘debug’
debug("%s: len=%d [bytes]\n", __func__, data_bytes);Signed-off-by Ley Foon Tan <[email protected]>
btw missing [PATCH v2 2/2] in the SUBJECT ...
Quoted 20 lines
---
v2: use "%lu" instead of cast data type to ulong.--- drivers/spi/cadence_qspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/spi/cadence_qspi.c +1
-1@@ -207,7 +207,7 @@ static int cadence_spi_xfer(struct udevice *dev, unsigned int bitlen, }else { data_bytes = bitlen /8 ; } -debug ("%s: len=%d [bytes]\n" , __func__, data_bytes); +debug ("%s: len=%lu [bytes]\n" , __func__, data_bytes);/* Set Chip select */ cadence_qspi_apb_chipselect(base, spi_chip_select(dev),
Signature · 2 lines
Best regards, Marek Vasut