Commit 22b726cb authored by Brian Norris's avatar Brian Norris Committed by Kalle Valo

rtw88: don't treat NULL pointer as an array

I'm not a standards expert, but this really looks to be undefined
behavior, when chip->dig_cck may be NULL. (And, we're trying to do a
NULL check a few lines down, because some chip variants will use NULL.)

Fixes: fc637a86 ("rtw88: 8723d: Set IG register for CCK rate")
Signed-off-by: default avatarBrian Norris <briannorris@chromium.org>
Acked-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200821211716.1631556-1-briannorris@chromium.org
parent 5466aff8
...@@ -147,12 +147,13 @@ void rtw_phy_dig_write(struct rtw_dev *rtwdev, u8 igi) ...@@ -147,12 +147,13 @@ void rtw_phy_dig_write(struct rtw_dev *rtwdev, u8 igi)
{ {
struct rtw_chip_info *chip = rtwdev->chip; struct rtw_chip_info *chip = rtwdev->chip;
struct rtw_hal *hal = &rtwdev->hal; struct rtw_hal *hal = &rtwdev->hal;
const struct rtw_hw_reg *dig_cck = &chip->dig_cck[0];
u32 addr, mask; u32 addr, mask;
u8 path; u8 path;
if (dig_cck) if (chip->dig_cck) {
const struct rtw_hw_reg *dig_cck = &chip->dig_cck[0];
rtw_write32_mask(rtwdev, dig_cck->addr, dig_cck->mask, igi >> 1); rtw_write32_mask(rtwdev, dig_cck->addr, dig_cck->mask, igi >> 1);
}
for (path = 0; path < hal->rf_path_num; path++) { for (path = 0; path < hal->rf_path_num; path++) {
addr = chip->dig[path].addr; addr = chip->dig[path].addr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment