* [PATCH net-next] mac80211: silent build warnings
@ 2015-01-08 7:04 Ying Xue
[not found] ` <1420700655-9427-1-git-send-email-ying.xue-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Ying Xue @ 2015-01-08 7:04 UTC (permalink / raw)
To: johannes-cdvu00un1VgdHxzADdlk8Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA
Silent the following build warnings:
net/mac80211/mlme.c: In function ‘ieee80211_rx_mgmt_beacon’:
net/mac80211/mlme.c:1348:3: warning: ‘pwr_level_cisco’ may be used uninitialized in this function [-Wuninitialized]
net/mac80211/mlme.c:1315:6: note: ‘pwr_level_cisco’ was declared here
Signed-off-by: Ying Xue <ying.xue-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
---
net/mac80211/mlme.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2c36c47..13b5506 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1312,7 +1312,7 @@ static u32 ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata,
{
bool has_80211h_pwr = false, has_cisco_pwr = false;
int chan_pwr = 0, pwr_reduction_80211h = 0;
- int pwr_level_cisco, pwr_level_80211h;
+ int pwr_level_cisco = 0, pwr_level_80211h = 0;
int new_ap_level;
if (country_ie && pwr_constr_ie &&
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] mac80211: silent build warnings
[not found] ` <1420700655-9427-1-git-send-email-ying.xue-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
@ 2015-01-08 7:41 ` Johannes Berg
[not found] ` <1420702907.2029.2.camel-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
2015-01-08 12:59 ` Sergei Shtylyov
1 sibling, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2015-01-08 7:41 UTC (permalink / raw)
To: Ying Xue
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA
On Thu, 2015-01-08 at 15:04 +0800, Ying Xue wrote:
> Silent the following build warnings:
>
> net/mac80211/mlme.c: In function ‘ieee80211_rx_mgmt_beacon’:
> net/mac80211/mlme.c:1348:3: warning: ‘pwr_level_cisco’ may be used uninitialized in this function [-Wuninitialized]
> net/mac80211/mlme.c:1315:6: note: ‘pwr_level_cisco’ was declared here
We seem to get this every year or so... just upgrade your compiler and
it will be smart enough to prove that it's wrong here.
I really *don't* want to shut up the compiler forcefully since it will
cause modern compilers to *not* warn if it actually *is* unused - and 0
is not a useful value - this code is tricky enough and we want compiler
help in case we need to modify it in the future.
johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] mac80211: silent build warnings
[not found] ` <1420702907.2029.2.camel-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
@ 2015-01-08 7:45 ` Ying Xue
0 siblings, 0 replies; 5+ messages in thread
From: Ying Xue @ 2015-01-08 7:45 UTC (permalink / raw)
To: Johannes Berg
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA
On 01/08/2015 03:41 PM, Johannes Berg wrote:
> On Thu, 2015-01-08 at 15:04 +0800, Ying Xue wrote:
>> Silent the following build warnings:
>>
>> net/mac80211/mlme.c: In function ‘ieee80211_rx_mgmt_beacon’:
>> net/mac80211/mlme.c:1348:3: warning: ‘pwr_level_cisco’ may be used uninitialized in this function [-Wuninitialized]
>> net/mac80211/mlme.c:1315:6: note: ‘pwr_level_cisco’ was declared here
>
> We seem to get this every year or so... just upgrade your compiler and
> it will be smart enough to prove that it's wrong here.
>
> I really *don't* want to shut up the compiler forcefully since it will
> cause modern compilers to *not* warn if it actually *is* unused - and 0
> is not a useful value - this code is tricky enough and we want compiler
> help in case we need to modify it in the future.
>
Thank for your explanation, and please ignore the noise.
Regards,
Ying
> johannes
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] mac80211: silent build warnings
[not found] ` <1420700655-9427-1-git-send-email-ying.xue-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2015-01-08 7:41 ` Johannes Berg
@ 2015-01-08 12:59 ` Sergei Shtylyov
2015-01-09 1:00 ` Ying Xue
1 sibling, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2015-01-08 12:59 UTC (permalink / raw)
To: Ying Xue, johannes-cdvu00un1VgdHxzADdlk8Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA
Hello.
On 1/8/2015 10:04 AM, Ying Xue wrote:
> Silent the following build warnings:
> net/mac80211/mlme.c: In function ‘ieee80211_rx_mgmt_beacon’:
> net/mac80211/mlme.c:1348:3: warning: ‘pwr_level_cisco’ may be used uninitialized in this function [-Wuninitialized]
> net/mac80211/mlme.c:1315:6: note: ‘pwr_level_cisco’ was declared here
> Signed-off-by: Ying Xue <ying.xue-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
> ---
> net/mac80211/mlme.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index 2c36c47..13b5506 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -1312,7 +1312,7 @@ static u32 ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata,
> {
> bool has_80211h_pwr = false, has_cisco_pwr = false;
> int chan_pwr = 0, pwr_reduction_80211h = 0;
> - int pwr_level_cisco, pwr_level_80211h;
> + int pwr_level_cisco = 0, pwr_level_80211h = 0;
OK, but why are you also initializing the second variable?
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] mac80211: silent build warnings
2015-01-08 12:59 ` Sergei Shtylyov
@ 2015-01-09 1:00 ` Ying Xue
0 siblings, 0 replies; 5+ messages in thread
From: Ying Xue @ 2015-01-09 1:00 UTC (permalink / raw)
To: Sergei Shtylyov, johannes; +Cc: netdev, linux-wireless
On 01/08/2015 08:59 PM, Sergei Shtylyov wrote:
> Hello.
>
> On 1/8/2015 10:04 AM, Ying Xue wrote:
>
>> Silent the following build warnings:
>
>> net/mac80211/mlme.c: In function ‘ieee80211_rx_mgmt_beacon’:
>> net/mac80211/mlme.c:1348:3: warning: ‘pwr_level_cisco’ may be used
>> uninitialized in this function [-Wuninitialized]
>> net/mac80211/mlme.c:1315:6: note: ‘pwr_level_cisco’ was declared here
>
>> Signed-off-by: Ying Xue <ying.xue@windriver.com>
>> ---
>> net/mac80211/mlme.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
>> index 2c36c47..13b5506 100644
>> --- a/net/mac80211/mlme.c
>> +++ b/net/mac80211/mlme.c
>> @@ -1312,7 +1312,7 @@ static u32 ieee80211_handle_pwr_constr(struct
>> ieee80211_sub_if_data *sdata,
>> {
>> bool has_80211h_pwr = false, has_cisco_pwr = false;
>> int chan_pwr = 0, pwr_reduction_80211h = 0;
>> - int pwr_level_cisco, pwr_level_80211h;
>> + int pwr_level_cisco = 0, pwr_level_80211h = 0;
>
> OK, but why are you also initializing the second variable?
>
Although the second variable is not warned in above compile warning
message, but it should be if we take a look at the code associated with it.
However, as Johannes confirmed, the first change is unnecessary at all.
So please ignore the patch.
Thanks,
Ying
> WBR, Sergei
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-01-09 1:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-08 7:04 [PATCH net-next] mac80211: silent build warnings Ying Xue
[not found] ` <1420700655-9427-1-git-send-email-ying.xue-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2015-01-08 7:41 ` Johannes Berg
[not found] ` <1420702907.2029.2.camel-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
2015-01-08 7:45 ` Ying Xue
2015-01-08 12:59 ` Sergei Shtylyov
2015-01-09 1:00 ` Ying Xue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).