All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soc: qcom: cmd-db: Cast sizeof() to int to silence field width warning
@ 2020-04-15  6:20 Stephen Boyd
  2020-04-15  6:28 ` Stephen Boyd
  2020-04-17 13:56 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Boyd @ 2020-04-15  6:20 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson; +Cc: linux-kernel, linux-arm-msm, Stephen Rothwell

We pass the result of sizeof() here to tell the printk format specifier
how many bytes to print. That expects an int though and sizeof() isn't
that type. Cast to int to silence this warning:

drivers/soc/qcom/cmd-db.c: In function 'cmd_db_debugfs_dump':
drivers/soc/qcom/cmd-db.c:281:30: warning: field width specifier '*' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/soc/qcom/cmd-db.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c
index 6c308f92a13c..6b5c440c9dc3 100644
--- a/drivers/soc/qcom/cmd-db.c
+++ b/drivers/soc/qcom/cmd-db.c
@@ -280,7 +280,7 @@ static int cmd_db_debugfs_dump(struct seq_file *seq, void *p)
 		ent = rsc_to_entry_header(rsc);
 		for (j = 0; j < le16_to_cpu(rsc->cnt); j++, ent++) {
 			seq_printf(seq, "0x%08x: %*pEp", le32_to_cpu(ent->addr),
-				   sizeof(ent->id), ent->id);
+				   (int)sizeof(ent->id), ent->id);
 
 			len = le16_to_cpu(ent->len);
 			if (len) {
-- 
Sent by a computer, using git, on the internet


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] soc: qcom: cmd-db: Cast sizeof() to int to silence field width warning
  2020-04-15  6:20 [PATCH] soc: qcom: cmd-db: Cast sizeof() to int to silence field width warning Stephen Boyd
@ 2020-04-15  6:28 ` Stephen Boyd
  2020-04-17 13:56 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2020-04-15  6:28 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson; +Cc: linux-kernel, linux-arm-msm, Stephen Rothwell

Quoting Stephen Boyd (2020-04-14 23:20:33)
> We pass the result of sizeof() here to tell the printk format specifier
> how many bytes to print. That expects an int though and sizeof() isn't
> that type. Cast to int to silence this warning:
> 
> drivers/soc/qcom/cmd-db.c: In function 'cmd_db_debugfs_dump':
> drivers/soc/qcom/cmd-db.c:281:30: warning: field width specifier '*' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
> 
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>

Also

Fixes: d6815c5c43d4 ("soc: qcom: cmd-db: Add debugfs dumping file")

> ---
>  drivers/soc/qcom/cmd-db.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c
> index 6c308f92a13c..6b5c440c9dc3 100644
> --- a/drivers/soc/qcom/cmd-db.c
> +++ b/drivers/soc/qcom/cmd-db.c
> @@ -280,7 +280,7 @@ static int cmd_db_debugfs_dump(struct seq_file *seq, void *p)
>                 ent = rsc_to_entry_header(rsc);
>                 for (j = 0; j < le16_to_cpu(rsc->cnt); j++, ent++) {
>                         seq_printf(seq, "0x%08x: %*pEp", le32_to_cpu(ent->addr),
> -                                  sizeof(ent->id), ent->id);
> +                                  (int)sizeof(ent->id), ent->id);
>  
>                         len = le16_to_cpu(ent->len);
>                         if (len) {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] soc: qcom: cmd-db: Cast sizeof() to int to silence field width warning
  2020-04-15  6:20 [PATCH] soc: qcom: cmd-db: Cast sizeof() to int to silence field width warning Stephen Boyd
  2020-04-15  6:28 ` Stephen Boyd
@ 2020-04-17 13:56 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2020-04-17 13:56 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Andy Gross, Bjorn Andersson, linux-kernel, linux-arm-msm,
	Stephen Rothwell

On Tue, Apr 14, 2020 at 11:20:33PM -0700, Stephen Boyd wrote:
> We pass the result of sizeof() here to tell the printk format specifier
> how many bytes to print. That expects an int though and sizeof() isn't
> that type. Cast to int to silence this warning:
> 
> drivers/soc/qcom/cmd-db.c: In function 'cmd_db_debugfs_dump':
> drivers/soc/qcom/cmd-db.c:281:30: warning: field width specifier '*' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
> 
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/soc/qcom/cmd-db.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c
> index 6c308f92a13c..6b5c440c9dc3 100644
> --- a/drivers/soc/qcom/cmd-db.c
> +++ b/drivers/soc/qcom/cmd-db.c
> @@ -280,7 +280,7 @@ static int cmd_db_debugfs_dump(struct seq_file *seq, void *p)
>  		ent = rsc_to_entry_header(rsc);
>  		for (j = 0; j < le16_to_cpu(rsc->cnt); j++, ent++) {
>  			seq_printf(seq, "0x%08x: %*pEp", le32_to_cpu(ent->addr),
> -				   sizeof(ent->id), ent->id);
> +				   (int)sizeof(ent->id), ent->id);
>  
>  			len = le16_to_cpu(ent->len);
>  			if (len) {

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-17 13:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-15  6:20 [PATCH] soc: qcom: cmd-db: Cast sizeof() to int to silence field width warning Stephen Boyd
2020-04-15  6:28 ` Stephen Boyd
2020-04-17 13:56 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.