* [PATCH] mac80211: avoid "uninitialised variable" warning
@ 2014-05-20 7:36 Antonio Quartulli
2014-05-20 7:49 ` Johannes Berg
0 siblings, 1 reply; 2+ messages in thread
From: Antonio Quartulli @ 2014-05-20 7:36 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Antonio Quartulli
gcc is not able to correlate chan_pwr and have_chan_pwr
in ieee80211_handle_pwr_constr(), therefore it throws a
warning about chan_pwr being potentially used uninitialised
even if this is not true.
However, initialise chan_pwr to 0 to silent the warning.
Signed-off-by: Antonio Quartulli <antonio@meshcoding.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 7f073ef..43a2a7c 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1146,7 +1146,7 @@ static u32 ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata,
{
struct ieee80211_country_ie_triplet *triplet;
int chan = ieee80211_frequency_to_channel(channel->center_freq);
- int i, chan_pwr, chan_increment, new_ap_level;
+ int i, chan_pwr = 0, chan_increment, new_ap_level;
bool have_chan_pwr = false;
/* Invalid IE */
--
1.8.5.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mac80211: avoid "uninitialised variable" warning
2014-05-20 7:36 [PATCH] mac80211: avoid "uninitialised variable" warning Antonio Quartulli
@ 2014-05-20 7:49 ` Johannes Berg
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2014-05-20 7:49 UTC (permalink / raw)
To: Antonio Quartulli; +Cc: linux-wireless
On Tue, 2014-05-20 at 09:36 +0200, Antonio Quartulli wrote:
> gcc is not able to correlate chan_pwr and have_chan_pwr
> in ieee80211_handle_pwr_constr(), therefore it throws a
> warning about chan_pwr being potentially used uninitialised
> even if this is not true.
>
> However, initialise chan_pwr to 0 to silent the warning.
I don't see any warnings (even with -Wmaybe-uninitialized added
manually) and don't like gratuitous initializations, so I'll drop this.
johannes
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-20 7:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-20 7:36 [PATCH] mac80211: avoid "uninitialised variable" warning Antonio Quartulli
2014-05-20 7:49 ` Johannes Berg
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).