Commit d3a85737 authored by Jérôme Pouiller's avatar Jérôme Pouiller Committed by Greg Kroah-Hartman
Browse files

staging: wfx: fix use of uninitialized pointer



With -Wuninitialized, the compiler complains:

drivers/staging/wfx/data_tx.c:34:19: warning: variable 'band' is uninitialized when used here [-Wuninitialized]
    if (rate->idx >= band->n_bitrates) {
                         ^~~~

Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Fixes: 868fd970 ("staging: wfx: improve robustness of wfx_get_hw_rate()")
Signed-off-by: default avatarJérôme Pouiller <jerome.pouiller@silabs.com>
Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Link: https://lore.kernel.org/r/20201019160604.1609180-1-Jerome.Pouiller@silabs.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b6ae84d6
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -31,13 +31,13 @@ static int wfx_get_hw_rate(struct wfx_dev *wdev,
		}
		return rate->idx + 14;
	}
	// WFx only support 2GHz, else band information should be retrieved
	// from ieee80211_tx_info
	band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ];
	if (rate->idx >= band->n_bitrates) {
		WARN(1, "wrong rate->idx value: %d", rate->idx);
		return -1;
	}
	// WFx only support 2GHz, else band information should be retrieved
	// from ieee80211_tx_info
	band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ];
	return band->bitrates[rate->idx].hw_value;
}