diff mbox

[1/2] spi: core: Use %zu for printing 'size_t' type

Message ID 1455722424-15490-1-git-send-email-fabio.estevam@nxp.com (mailing list archive)
State Accepted
Commit 7d62f51e74c62afc79f63c70ae48f1b8de57f5d4
Headers show

Commit Message

Fabio Estevam Feb. 17, 2016, 3:20 p.m. UTC
Use %zu for printing 'size_t' type in order to fix the following
build warning on ARM64:

drivers/spi/spi.c: In function '__spi_split_transfer_maxsize':
drivers/spi/spi.c:2278:2: warning: format '%i' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat=]

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
 drivers/spi/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Geert Uytterhoeven Feb. 17, 2016, 5:35 p.m. UTC | #1
On Wed, Feb 17, 2016 at 4:20 PM, Fabio Estevam <fabio.estevam@nxp.com> wrote:
> Use %zu for printing 'size_t' type in order to fix the following
> build warning on ARM64:
>
> drivers/spi/spi.c: In function '__spi_split_transfer_maxsize':
> drivers/spi/spi.c:2278:2: warning: format '%i' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat=]
>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>

Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>

However, I'm still wondering whether using size_t for this variable is
the right thing to
do. Maximum SPI transfer length is unsigned int.

> ---
>  drivers/spi/spi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index f6c76be..0725ffa 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -2276,7 +2276,7 @@ static int __spi_split_transfer_maxsize(struct spi_master *master,
>
>         /* warn once about this fact that we are splitting a transfer */
>         dev_warn_once(&msg->spi->dev,
> -                     "spi_transfer of length %i exceed max length of %i - needed to split transfers\n",
> +                     "spi_transfer of length %i exceed max length of %zu - needed to split transfers\n",
>                       xfer->len, maxsize);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index f6c76be..0725ffa 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2276,7 +2276,7 @@  static int __spi_split_transfer_maxsize(struct spi_master *master,
 
 	/* warn once about this fact that we are splitting a transfer */
 	dev_warn_once(&msg->spi->dev,
-		      "spi_transfer of length %i exceed max length of %i - needed to split transfers\n",
+		      "spi_transfer of length %i exceed max length of %zu - needed to split transfers\n",
 		      xfer->len, maxsize);
 
 	/* calculate how many we have to replace */