Re: [PATCH] wifi: ath11k: fix remapped ce accessing issue on 64bit OS

From: Kalle Valo
Date: Thu May 02 2024 - 03:05:57 EST


Jeff Johnson <quic_jjohnson@xxxxxxxxxxx> writes:

>> static inline u32 ath11k_ahb_read32(struct ath11k_base *ab, u32 offset)
>> {
>> - return ioread32(ab->mem + offset);
>> + switch (offset & ATH11K_REG_TYPE_MASK) {
>> + case ATH11K_REG_TYPE_NORMAL:
>> + return ioread32(ab->mem + FIELD_GET(ATH11K_REG_OFFSET_MASK, offset));
>> + case ATH11K_REG_TYPE_CE:
>> + return ioread32(ab->mem_ce + FIELD_GET(ATH11K_REG_OFFSET_MASK, offset));
>> + default:
>> + BUG();
>
> you can WARN but you can't BUG (and even WARN is being discouraged)

Yeah, even WARN() is risky especially in a function like this. It can
cause so much log messages so that the wathdog can trigger and reboot
the host.

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches