Re: [PATCH] spi: stm32: update dev_dbg() print format for SPI params

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

 



On Mon, Jan 4, 2021 at 10:55 AM Alexandru Ardelean
<alexandru.ardelean@xxxxxxxxxx> wrote:
>
> With the introduction of the 'include/uapi/linux/spi/spi.h' header, the
> type of the macros are enforced to 'unsigned long int' via the _BITUL()
> macro.
>
> This causes some -Wformat warnings in the spi-stm32 driver.
> This patch changes the printf() specifiers from '%d' to '%lu' to
> accommodate for this change.
>
> Fixes: f7005142dace ("spi: uapi: unify SPI modes into a single spi.h header")
> Reported-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>

LKP also reported this before.

...

> -       dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
> +       dev_dbg(spi->dev, "cpol=%lu cpha=%lu lsb_first=%lu cs_high=%lu\n",
>                 spi_dev->mode & SPI_CPOL,
>                 spi_dev->mode & SPI_CPHA,
>                 spi_dev->mode & SPI_LSB_FIRST,

Wouldn't the output be a bit awful with all these?

I think the proper fix is to add !! to each bit mask.

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux