2013-09-28 17:47:09

by Vincent Stehlé

[permalink] [raw]
Subject: [PATCH linux-next] skd: fix some VPRINTK() specifiers for size_t

Use %zu for VPRINTK() as size_t specifier in replacement of %u.

This fixes 7 compilation warnings on x86_64 like the following:

drivers/block/skd_main.c:4628:42: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has type ‘long unsigned int’ [-Wformat=]

While at it, remove one cast to unsigned long for a size_t VPRINTK() argument
and specify it as %zu, too.

Signed-off-by: Vincent Stehlé <[email protected]>
Cc: Andrew Morton <[email protected]>
---

Hi,

This can be seen on e.g. linux next-20130927.

Best regards,

V.

drivers/block/skd_main.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 3110f68..ee7f7a8 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -4556,11 +4556,10 @@ static int skd_cons_skmsg(struct skd_device *skdev)
int rc = 0;
u32 i;

- VPRINTK(skdev, "skmsg_table kzalloc, struct %u, count %u total %lu\n",
+ VPRINTK(skdev, "skmsg_table kzalloc, struct %zu, count %u total %zu\n",
sizeof(struct skd_fitmsg_context),
skdev->num_fitmsg_context,
- (unsigned long) sizeof(struct skd_fitmsg_context) *
- skdev->num_fitmsg_context);
+ sizeof(struct skd_fitmsg_context) * skdev->num_fitmsg_context);

skdev->skmsg_table = kzalloc(sizeof(struct skd_fitmsg_context)
*skdev->num_fitmsg_context, GFP_KERNEL);
@@ -4611,7 +4610,7 @@ static int skd_cons_skreq(struct skd_device *skdev)
int rc = 0;
u32 i;

- VPRINTK(skdev, "skreq_table kzalloc, struct %u, count %u total %u\n",
+ VPRINTK(skdev, "skreq_table kzalloc, struct %zu, count %u total %zu\n",
sizeof(struct skd_request_context),
skdev->num_req_context,
sizeof(struct skd_request_context) * skdev->num_req_context);
@@ -4623,7 +4622,7 @@ static int skd_cons_skreq(struct skd_device *skdev)
goto err_out;
}

- VPRINTK(skdev, "alloc sg_table sg_per_req %u scatlist %u total %u\n",
+ VPRINTK(skdev, "alloc sg_table sg_per_req %u scatlist %zu total %zu\n",
skdev->sgs_per_request, sizeof(struct scatterlist),
skdev->sgs_per_request * sizeof(struct scatterlist));

@@ -4668,7 +4667,7 @@ static int skd_cons_skspcl(struct skd_device *skdev)
int rc = 0;
u32 i, nbytes;

- VPRINTK(skdev, "skspcl_table kzalloc, struct %u, count %u total %u\n",
+ VPRINTK(skdev, "skspcl_table kzalloc, struct %zu, count %u total %zu\n",
sizeof(struct skd_special_context),
skdev->n_special,
sizeof(struct skd_special_context) * skdev->n_special);
--
1.8.4.rc3