From d3a85737521a8570adf3a8171b4b3e42216686ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Pouiller?= Date: Mon, 19 Oct 2020 18:06:03 +0200 Subject: staging: wfx: fix use of uninitialized pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: kernel test robot Reported-by: Nathan Chancellor Fixes: 868fd970e187 ("staging: wfx: improve robustness of wfx_get_hw_rate()") Signed-off-by: Jérôme Pouiller Reviewed-by: Nathan Chancellor Link: https://lore.kernel.org/r/20201019160604.1609180-1-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/data_tx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging/wfx') diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 41f6a604a697..36b36ef39d05 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -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; } -- cgit v1.2.3