Tony,

I had not tested rtw88 for some time, so I built a kernel with the V3 patches and found that rtw88 crashed with a NULL pointer dereference. I did some debugging and found that the problem was in routine rtw_chip_efuse_enable() where fw->firmware was NULL.

Next I verified that rtw_load_firmware() had been called, which gave a clue that the firmware had not finished loading by the time rtw_chip_efuse_enable() was called. By adding a wait_for_completion() call before the rtw_download_firmware() call, the problem was fixed. The problem was a race between calling rtw_chip_efuse_enable() and the firmware load from disk. Obviously, the speed ratio between my CPU and the disk system is much different on my laptop than on your test machines, thus I have the problem.

The patch I used is attached.

Larry
diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index a189c4500fd9..690c0a68a038 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -902,6 +902,7 @@ static int rtw_chip_efuse_enable(struct rtw_dev *rtwdev)
 		goto err;
 	}
 
+	wait_for_completion(&fw->completion);
 	rtw_write8(rtwdev, REG_C2HEVT, C2H_HW_FEATURE_DUMP);
 	ret = rtw_download_firmware(rtwdev, fw->firmware->data,
 				    fw->firmware->size);

Reply via email to