* [PATCH] fsi: master-ast-cf: use correct format string for size_t
@ 2018-07-24 9:34 Arnd Bergmann
2018-07-24 12:05 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2018-07-24 9:34 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Arnd Bergmann, linux-kernel
On 32-bit targets, size_t is often 'unsigned int', so printing it as %lu
causes a warning:
drivers/fsi/fsi-master-ast-cf.c: In function 'fsi_master_acf_read':
drivers/fsi/fsi-master-ast-cf.c:609:23: error: format '%u' expects argument of type 'unsigned int', but argument 6 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=]
dev_dbg(master->dev, "read id %d addr %x size %ud\n", id, addr, size);
drivers/fsi/fsi-master-ast-cf.c: In function 'fsi_master_acf_write':
drivers/fsi/fsi-master-ast-cf.c:634:23: error: format '%u' expects argument of type 'unsigned int', but argument 6 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=]
The correct format string is %zu.
Fixes: 6a794a27daca ("fsi: master-ast-cf: Add new FSI master using Aspeed ColdFire")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/fsi/fsi-master-ast-cf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/fsi/fsi-master-ast-cf.c b/drivers/fsi/fsi-master-ast-cf.c
index 57afaae0b691..d1bbdf8b8343 100644
--- a/drivers/fsi/fsi-master-ast-cf.c
+++ b/drivers/fsi/fsi-master-ast-cf.c
@@ -606,7 +606,7 @@ static int fsi_master_acf_read(struct fsi_master *_master, int link,
return -ENODEV;
mutex_lock(&master->lock);
- dev_dbg(master->dev, "read id %d addr %x size %ud\n", id, addr, size);
+ dev_dbg(master->dev, "read id %d addr %x size %zu\n", id, addr, size);
build_ar_command(master, &cmd, id, addr, size, NULL);
rc = fsi_master_acf_xfer(master, id, &cmd, size, val);
last_address_update(master, id, rc == 0, addr);
@@ -631,7 +631,7 @@ static int fsi_master_acf_write(struct fsi_master *_master, int link,
mutex_lock(&master->lock);
build_ar_command(master, &cmd, id, addr, size, val);
- dev_dbg(master->dev, "write id %d addr %x size %ud raw_data: %08x\n",
+ dev_dbg(master->dev, "write id %d addr %x size %zu raw_data: %08x\n",
id, addr, size, *(uint32_t *)val);
rc = fsi_master_acf_xfer(master, id, &cmd, 0, NULL);
last_address_update(master, id, rc == 0, addr);
--
2.18.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] fsi: master-ast-cf: use correct format string for size_t
2018-07-24 9:34 [PATCH] fsi: master-ast-cf: use correct format string for size_t Arnd Bergmann
@ 2018-07-24 12:05 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2018-07-24 12:05 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linux-kernel
On Tue, 2018-07-24 at 11:34 +0200, Arnd Bergmann wrote:
> On 32-bit targets, size_t is often 'unsigned int', so printing it as %lu
> causes a warning:
>
> drivers/fsi/fsi-master-ast-cf.c: In function 'fsi_master_acf_read':
> drivers/fsi/fsi-master-ast-cf.c:609:23: error: format '%u' expects argument of type 'unsigned int', but argument 6 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=]
> dev_dbg(master->dev, "read id %d addr %x size %ud\n", id, addr, size);
> drivers/fsi/fsi-master-ast-cf.c: In function 'fsi_master_acf_write':
> drivers/fsi/fsi-master-ast-cf.c:634:23: error: format '%u' expects argument of type 'unsigned int', but argument 6 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=]
>
> The correct format string is %zu.
Thanks Arnd, but I've already pushed such a fix in the fsi tree today
:)
Cheers,
Ben.
> Fixes: 6a794a27daca ("fsi: master-ast-cf: Add new FSI master using Aspeed ColdFire")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/fsi/fsi-master-ast-cf.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/fsi/fsi-master-ast-cf.c b/drivers/fsi/fsi-master-ast-cf.c
> index 57afaae0b691..d1bbdf8b8343 100644
> --- a/drivers/fsi/fsi-master-ast-cf.c
> +++ b/drivers/fsi/fsi-master-ast-cf.c
> @@ -606,7 +606,7 @@ static int fsi_master_acf_read(struct fsi_master *_master, int link,
> return -ENODEV;
>
> mutex_lock(&master->lock);
> - dev_dbg(master->dev, "read id %d addr %x size %ud\n", id, addr, size);
> + dev_dbg(master->dev, "read id %d addr %x size %zu\n", id, addr, size);
> build_ar_command(master, &cmd, id, addr, size, NULL);
> rc = fsi_master_acf_xfer(master, id, &cmd, size, val);
> last_address_update(master, id, rc == 0, addr);
> @@ -631,7 +631,7 @@ static int fsi_master_acf_write(struct fsi_master *_master, int link,
>
> mutex_lock(&master->lock);
> build_ar_command(master, &cmd, id, addr, size, val);
> - dev_dbg(master->dev, "write id %d addr %x size %ud raw_data: %08x\n",
> + dev_dbg(master->dev, "write id %d addr %x size %zu raw_data: %08x\n",
> id, addr, size, *(uint32_t *)val);
> rc = fsi_master_acf_xfer(master, id, &cmd, 0, NULL);
> last_address_update(master, id, rc == 0, addr);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-24 12:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-24 9:34 [PATCH] fsi: master-ast-cf: use correct format string for size_t Arnd Bergmann
2018-07-24 12:05 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®