diff mbox

[1/2] spi: Use %u for unsigned int, %zu for size_t

Message ID 1455802378-17780-1-git-send-email-thierry.reding@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thierry Reding Feb. 18, 2016, 1:32 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

When printing unsigned int it is more idiomatic to use %u, for size_t
the correct specifier is %zu (see Documentation/printk-formats.txt).

GCC only warns about the latter, but fixing up the former while at it
for consistency.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/spi/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown Feb. 18, 2016, 1:36 p.m. UTC | #1
On Thu, Feb 18, 2016 at 02:32:57PM +0100, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> When printing unsigned int it is more idiomatic to use %u, for size_t
> the correct specifier is %zu (see Documentation/printk-formats.txt).

These don't apply against current code, please check and resend.  Fabio
sent some similar patches the other day.
Thierry Reding Feb. 18, 2016, 1:58 p.m. UTC | #2
On Thu, Feb 18, 2016 at 01:36:19PM +0000, Mark Brown wrote:
> On Thu, Feb 18, 2016 at 02:32:57PM +0100, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > When printing unsigned int it is more idiomatic to use %u, for size_t
> > the correct specifier is %zu (see Documentation/printk-formats.txt).
> 
> These don't apply against current code, please check and resend.  Fabio
> sent some similar patches the other day.

I started seeing this two days ago and didn't submit because I assumed
somebody else already had. When it didn't filter out on top of today's
-next I decided to send out.

I do see that Fabio's fixes went into your tree yesterday, possibly not
quite in time to make today's -next. Both his patches fix the same
warnings that mine did. The only thing missing seems to be the %i -> %u
conversion, but I don't think I'll respin just for that.

Thierry
diff mbox

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index f6c76be39e96..f123f9f4d779 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 %u exceed max length of %zu - needed to split transfers\n",
 		      xfer->len, maxsize);
 
 	/* calculate how many we have to replace */