[U-Boot] [PATCH] spi: cadence_qspi: Fix compilation warning

Ley Foon Tan lftan.linux at gmail.com
Fri Jun 1 08:23:55 UTC 2018


On Fri, Jun 1, 2018 at 4:07 PM, Marek Vasut <marek.vasut at gmail.com> wrote:
> On 05/07/2018 11:42 AM, Ley Foon Tan wrote:
>> Cast data_bytes to integer.
>>
>> 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);
>>
>> Signed-off-by: Ley Foon Tan <ley.foon.tan at intel.com>
>> ---
>>  drivers/spi/cadence_qspi.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
>> index f80d073..dc4b5a4 100644
>> --- a/drivers/spi/cadence_qspi.c
>> +++ b/drivers/spi/cadence_qspi.c
>> @@ -208,7 +208,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=%d [bytes]\n", __func__, (int)data_bytes);
>
> This should probably be %lu instead of the cast.
Okay.
>
>>       /* Set Chip select */
>>       cadence_qspi_apb_chipselect(base, spi_chip_select(dev),
>>
>

Regards
Ley Foon


More information about the U-Boot mailing list