Re: [PATCH RESEND rtw-next v2 2/2] wifi: rtw88: 8822c: ignore nrx values without CCK PD registers
From: Luka Gejak
Date: Mon Nov 09 2026 - 01:43:18 EST
On November 8, 2026 7:28:37 PM GMT+01:00, Zeshan Ahmed Nobin
<zeshanahmednobin@xxxxxxxxx> wrote:
>rtw8822c_phy_cck_pd_set() reads nrx, the number of CCK RX paths minus
>one, from a 2-bit register field. The driver only ever sets it to 0 or
>1, for one or two RX paths (see rtw8822c_config_cck_rx_path()), and
>rtw8822c_cck_pd_reg[] only has registers for those two values; its
>entries for nrx 2 and 3 are all zero.
>
>A device that stops responding can return any value. On USB, a failed
>read returns whatever an earlier read left in the buffer, so bw can be
>0 or 1 while nrx is 2 or 3. When the level then changes,
>rtw8822c_phy_cck_pd_set_reg() gets past its WARN_ON(), which only
>checks nrx against RTW_RF_PATH_MAX, and calls rtw_read32_mask() and
>rtw_write32_mask() on register 0x0 with a zero mask. Both compute
>__ffs(0), which is undefined, and the write puts back whatever was read
>from register 0x0.
>
>Return early when rtw8822c_cck_pd_reg[] has no registers for nrx; bw
>has already been checked at that point.
>
>The fix and this message were drafted with an AI coding assistant
>(Claude Opus 5.5 by Anthropic), then reviewed and tested by the
>submitter.
>
>Reported-by: Luka Gejak <luka.gejak@xxxxxxxxx>
>Closes: https://lore.kernel.org/linux-wireless/f6a7d3272fe7635c6a83698dfab5d85500437ca6@xxxxxxxxx/
>Fixes: 479c4ee931a6 ("rtw88: add dynamic cck pd mechanism")
>Signed-off-by: Zeshan Ahmed Nobin <zeshanahmednobin@xxxxxxxxx>
>---
Looks good to me,
Reviewed-by: Luka Gejak <luka.gejak@xxxxxxxxx>
Best regards,
Luka Gejak