2008-01-04 22:06:15

by Miguel Botón

[permalink] [raw]
Subject: [PATCH] iwlwifi: fix compilation warning in 'iwl-4965.c'

This patch fixes a compilation warning in 'iwl-4965.c'.

Signed-off-by: Miguel Botón <[email protected]>

diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 74999af..92237cd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -3616,7 +3616,7 @@ static void iwl4965_add_radiotap(struct iwl4965_priv *priv,
if (skb_headroom(skb) < sizeof(*iwl4965_rt)) {
if (net_ratelimit())
printk(KERN_ERR "not enough headroom [%d] for "
- "radiotap head [%d]\n",
+ "radiotap head [%ld]\n",
skb_headroom(skb), sizeof(*iwl4965_rt));
return;
}

--
Miguel Botón


2008-01-04 22:13:25

by Roland Dreier

[permalink] [raw]
Subject: Re: [PATCH] iwlwifi: fix compilation warning in 'iwl-4965.c'

> - "radiotap head [%d]\n",
> + "radiotap head [%ld]\n",
> skb_headroom(skb), sizeof(*iwl4965_rt));

Actually I think the correct printf format for printing a size_t
(coming here from sizeof foo) is "%zd". Otherwise you'll fix the
warning on 64-bit targets but add a new warning on 32-bit targets.

- R.

2008-01-04 22:16:50

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH] iwlwifi: fix compilation warning in 'iwl-4965.c'

On Friday 04 January 2008 23:05:54 Miguel Botón wrote:
> This patch fixes a compilation warning in 'iwl-4965.c'.
>
> Signed-off-by: Miguel Botón <[email protected]>
>
> diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
> index 74999af..92237cd 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-4965.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
> @@ -3616,7 +3616,7 @@ static void iwl4965_add_radiotap(struct iwl4965_priv *priv,
> if (skb_headroom(skb) < sizeof(*iwl4965_rt)) {
> if (net_ratelimit())
> printk(KERN_ERR "not enough headroom [%d] for "
> - "radiotap head [%d]\n",
> + "radiotap head [%ld]\n",
> skb_headroom(skb), sizeof(*iwl4965_rt));

I think %zu is the correct and portable integer conversion for a size_t type.
The kernel implementation seems to support it.

--
Greetings Michael.

2008-01-04 22:18:19

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] iwlwifi: fix compilation warning in 'iwl-4965.c'

On Fri, 4 Jan 2008 23:05:54 +0100 Miguel Bot?n wrote:

> This patch fixes a compilation warning in 'iwl-4965.c'.

It would be helpful to have the warning message right here.<---

> Signed-off-by: Miguel Bot?n <[email protected]>
>
> diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
> index 74999af..92237cd 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-4965.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
> @@ -3616,7 +3616,7 @@ static void iwl4965_add_radiotap(struct iwl4965_priv *priv,
> if (skb_headroom(skb) < sizeof(*iwl4965_rt)) {
> if (net_ratelimit())
> printk(KERN_ERR "not enough headroom [%d] for "
> - "radiotap head [%d]\n",
> + "radiotap head [%ld]\n",
> skb_headroom(skb), sizeof(*iwl4965_rt));
> return;
> }

sizeof() (or size_t) normally needs %zd.

---
~Randy
desserts: http://www.xenotime.net/linux/recipes/

2008-01-04 22:31:36

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] iwlwifi: fix compilation warning in 'iwl-4965.c'

From: Roland Dreier <[email protected]>
Date: Fri, 04 Jan 2008 14:13:12 -0800

> > - "radiotap head [%d]\n",
> > + "radiotap head [%ld]\n",
> > skb_headroom(skb), sizeof(*iwl4965_rt));
>
> Actually I think the correct printf format for printing a size_t
> (coming here from sizeof foo) is "%zd". Otherwise you'll fix the
> warning on 64-bit targets but add a new warning on 32-bit targets.

Right.

2008-01-04 22:34:46

by Miguel Botón

[permalink] [raw]
Subject: Re: [PATCH] iwlwifi: fix compilation warning in 'iwl-4965.c'

Ok, there's a new patch.

This patch fixes a compilation warning in 'iwl-4965.c'.

"warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long unsigned int’"

Signed-off-by: Miguel Botón <[email protected]

diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 74999af..92237cd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -3616,7 +3616,7 @@ static void iwl4965_add_radiotap(struct iwl4965_priv *priv,
if (skb_headroom(skb) < sizeof(*iwl4965_rt)) {
if (net_ratelimit())
printk(KERN_ERR "not enough headroom [%d] for "
- "radiotap head [%d]\n",
+ "radiotap head [%zd]\n",
skb_headroom(skb), sizeof(*iwl4965_rt));
return;
}

--
Miguel Botón