[PATCH 3/4] wifi: ath12k: Refactor ath12k_get_num_hw() helper function argument
Karthikeyan Periyasamy
quic_periyasa at quicinc.com
Thu Dec 12 02:25:42 PST 2024
On 12/12/2024 1:19 PM, Kalle Valo wrote:
> Karthikeyan Periyasamy <quic_periyasa at quicinc.com> writes:
>
>> Currently, the ath12k_get_num_hw() helper function takes the device handle
>> as an argument. Here, the number of hardware is retrieved from the group
>> handle. Demanding the device handle from the caller is unnecessary since
>> in some cases the group handle is already available. Therefore, change this
>> helper function argument from the device handle to the group handle. This
>> also fixes the below Smatch static checker warning.
>>
>> Smatch warning:
>> ath12k_mac_destroy() error: we previously assumed 'ab' could be null
>>
>> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
>>
>> Reported-by: Dan Carpenter <dan.carpenter at linaro.org>
>> Closes: https://lore.kernel.org/ath12k/3e705de0-67d1-4437-97ff-4828d83ae2af@stanley.mountain/
>> Closes: https://scan7.scan.coverity.com/#/project-view/52682/11354?selectedIssue=1602340
>> Fixes: a343d97f27f5 ("wifi: ath12k: move struct ath12k_hw from per device to group")
>> Signed-off-by: Karthikeyan Periyasamy <quic_periyasa at quicinc.com>
>
> I don't get how this is any better but of course I might be missing
> something. To me this looks like shuffling code around to shut up a
> smatch warning.
>
It just remove the dependency of device handle (ab) for using the helper
function ath12k_get_num_hw(). Now the caller can directly use
ath12k_hw_group (ag) instead of forcing to use the device handle from
ag. Because there may be error case where no device present in the ag.
--
Karthikeyan Periyasamy
--
கார்த்திகேயன் பெரியசாமி
More information about the ath12k
mailing list