Devicetree
 help / color / mirror / Atom feed
From: Madhavan Ganesan <madhavan.ganesan@oss.qualcomm.com>
To: sashiko-reviews@lists.linux.dev
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH ath-next 09/15] wifi: ath12k: add unified firmware image support for QCN9575
Date: Wed, 18 Nov 2026 10:54:02 +0530	[thread overview]
Message-ID: <d98bb7d7-f1fe-4e25-939f-5ca247b32e44@oss.qualcomm.com> (raw)
In-Reply-To: <sashiko-outbox-210895@kernel.org>



On 11/12/2026 3:14 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found no new issues
> in this patch, but noticed 1 related pre-existing issue it does not
> introduce:
> - [Medium] wifi: ath12k: memory leak of mhi_ctrl->irq in
>    ath12k_mhi_register() [1]
> --
> 
> commit 7e637beba6af9aa8998e9035d9033a359dbfb287
> Author: Madhavan Ganesan <madhavan.ganesan@oss.qualcomm.com>
> 
> wifi: ath12k: add unified firmware image support for QCN9575
> 
> This commit adds unified firmware image support for QCN9575 by caching the
> OTP board ID in ath12k_mhi_register() and writing it to a PCIe scratch
> register with readback verification in ath12k_pci_power_up().
> 
>> diff --git a/drivers/net/wireless/ath/ath12k/mhi.c b/drivers/net/wireless/ath/ath12k/mhi.c
>> index 56e697fbdad52..90b7774ae6e8c 100644
>> --- a/drivers/net/wireless/ath/ath12k/mhi.c
>> +++ b/drivers/net/wireless/ath/ath12k/mhi.c
>> @@ -211,6 +211,8 @@ int ath12k_mhi_register(struct ath12k_pci *ab_pci)
>>   		if (!board_id || (board_id == OTP_INVALID_BOARD_ID)) {
>>   			ath12k_dbg(ab, ATH12K_DBG_BOOT,
>>   				   "failed to read board id\n");
>> +		} else if (ab->hw_params->fw.unified_fw_image) {
>> +			ab_pci->unified_fw_board_id = board_id;
>>   		} else if (board_id & OTP_VALID_DUALMAC_BOARD_ID_MASK) {
>>   			dualmac = true;
>>   			ath12k_dbg(ab, ATH12K_DBG_BOOT,
>> @@ -218,7 +220,7 @@ int ath12k_mhi_register(struct ath12k_pci *ab_pci)
>>   		}
>>   	}
>>   
>> -	if (dualmac) {
>> +	if (!ab->hw_params->fw.unified_fw_image && dualmac) {
>>   		if (ab->fw.amss_dualmac_data && ab->fw.amss_dualmac_len > 0) {
>>   			/* use MHI firmware file from firmware-N.bin */
>>   			mhi_ctrl->fw_data = ab->fw.amss_dualmac_data;
> 
> [Severity: Medium]
> This problem wasn't introduced by this patch, but does ath12k_mhi_register()
> leak mhi_ctrl->irq [1] if mhi_register_controller() fails?
> 
> ath12k_mhi_get_msi() allocates the irq array with kcalloc() and assigns it
> to mhi_ctrl->irq.  If mhi_register_controller() fails later in
> ath12k_mhi_register(), the free_controller error path only calls
> mhi_free_controller(), which does not free the driver-allocated irq array:
> 
> drivers/net/wireless/ath/ath12k/mhi.c:ath12k_mhi_register() {
> 	...
> 	ret = ath12k_mhi_get_msi(ab_pci);
> 	if (ret) {
> 		ath12k_err(ab, "failed to get msi for mhi\n");
> 		goto free_controller;
> 	}
> 	...
> 	ret = mhi_register_controller(mhi_ctrl, ab->hw_params->mhi_config);
> 	if (ret) {
> 		ath12k_err(ab, "failed to register to mhi bus, err = %d\n", ret);
> 		goto free_controller;
> 	}
> 
> 	return 0;
> 
> free_controller:
> 	mhi_free_controller(mhi_ctrl);
> 	ab_pci->mhi_ctrl = NULL;
> 	return ret;
> }
> 
> Calling kfree(mhi_ctrl->irq) on the error path before mhi_free_controller(),
> matching ath12k_mhi_unregister(), would avoid the leak.
> 
> [1] https://sashiko.dev/#/bug/linux-7faf2081-d31b-4759-a736-dcc2f8a00de5
> 

This is a pre-existing bug. I will fix it in a separate patch.

  reply	other threads:[~2026-11-18  5:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  8:32 [PATCH ath-next 00/15] wifi: ath12k: add initial Wi-Fi 8 support for QCN9575 Madhavan Ganesan
2026-11-12  8:32 ` [PATCH ath-next 01/15] dt-bindings: net: wireless: add ath12k wifi device QCN9575 Madhavan Ganesan
2026-11-12  8:32 ` [PATCH ath-next 02/15] wifi: ath12k: refactor PCI window selection to per-device layout Madhavan Ganesan
2026-11-12  8:46   ` sashiko-bot
2026-11-18  5:23     ` Madhavan Ganesan
2026-11-12  8:32 ` [PATCH ath-next 03/15] wifi: ath12k: add extended QMI WLAN cfg for CE and service pipes Madhavan Ganesan
2026-11-12  8:32 ` [PATCH ath-next 04/15] wifi: ath12k: add QMI support for extended firmware binary download Madhavan Ganesan
2026-11-12  9:07   ` sashiko-bot
2026-11-18  5:23     ` Madhavan Ganesan
2026-11-12  8:32 ` [PATCH ath-next 05/15] wifi: ath12k: add Wi-Fi 8 directory and base module scaffolding Madhavan Ganesan
2026-11-12  8:32 ` [PATCH ath-next 06/15] wifi: ath12k: add initial Wi-Fi 8 hw params and init helper for QCN9575 Madhavan Ganesan
2026-11-12  8:32 ` [PATCH ath-next 07/15] wifi: ath12k: add Wi-Fi 8 HAL register table and hal init hook " Madhavan Ganesan
2026-11-12  8:32 ` [PATCH ath-next 08/15] wifi: ath12k: add Wi-Fi 8 HAL ops and descriptor definitions " Madhavan Ganesan
2026-11-12  9:25   ` sashiko-bot
2026-11-18  5:23     ` Madhavan Ganesan
2026-11-12  8:32 ` [PATCH ath-next 09/15] wifi: ath12k: add unified firmware image support " Madhavan Ganesan
2026-11-12  9:44   ` sashiko-bot
2026-11-18  5:24     ` Madhavan Ganesan [this message]
2026-11-12  8:32 ` [PATCH ath-next 10/15] wifi: ath12k: add Wi-Fi 8 MHI config " Madhavan Ganesan
2026-11-12  8:32 ` [PATCH ath-next 11/15] wifi: ath12k: add Wi-Fi 8 CE config and service pipe map " Madhavan Ganesan
2026-11-12  8:32 ` [PATCH ath-next 12/15] wifi: ath12k: add Wi-Fi 8 WMI init " Madhavan Ganesan
2026-11-12  8:32 ` [PATCH ath-next 13/15] wifi: ath12k: add Wi-Fi 8 hw ops " Madhavan Ganesan
2026-11-12  8:32 ` [PATCH ath-next 14/15] wifi: ath12k: add and hook Wi-Fi 8 mac80211 ops skeleton " Madhavan Ganesan
2026-11-12 10:19   ` sashiko-bot
2026-11-18  5:24     ` Madhavan Ganesan
2026-11-12  8:32 ` [PATCH ath-next 15/15] wifi: ath12k: add Wi-Fi 8 PCI driver scaffolding " Madhavan Ganesan
2026-11-12 10:29   ` sashiko-bot
2026-11-18  5:24     ` Madhavan Ganesan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d98bb7d7-f1fe-4e25-939f-5ca247b32e44@oss.qualcomm.com \
    --to=madhavan.ganesan@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox