Linux wireless drivers development
 help / color / mirror / Atom feed
From: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
To: Aaradhana Sahu <aaradhana.sahu@oss.qualcomm.com>,
	ath12k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org, jjohnson@kernel.org,
	quic_kiranv@quicinc.com,
	vasanthakumar.thiagarajan@oss.qualcomm.com
Subject: Re: [PATCH ath-next 1/2] wifi: ath12k: Free allocated CE IRQs on request_irq() failure
Date: Wed, 19 Aug 2026 18:13:31 +0800	[thread overview]
Message-ID: <3be7c1ed-6298-4d85-bb47-3bd0337eca6a@oss.qualcomm.com> (raw)
In-Reply-To: <20260819065425.2044186-2-aaradhana.sahu@oss.qualcomm.com>



On 8/19/2026 2:54 PM, Aaradhana Sahu wrote:
> When CE IRQ configuration fails, the driver does not release all IRQs
> that were successfully requested before the failure. This can leak IRQ
> resources during probe failure.
> 
> Free the previously requested CE IRQs before returning from the error
> path to ensure that partially initialized IRQ resources are properly
> cleaned up during probe failure.
> 
> Factor out the CE IRQ cleanup into a helper to reuse the cleanup logic
> during both error handling and driver teardown.
> 
> Also free CE IRQs when external IRQ configuration fails, before
> returning from the error path.
> 
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1
> 
> Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
> Signed-off-by: Aaradhana Sahu <aaradhana.sahu@oss.qualcomm.com>
> ---
>  drivers/net/wireless/ath/ath12k/pci.c | 29 ++++++++++++++++++---------
>  1 file changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c
> index 6441927b5382..9a78d2f69f94 100644
> --- a/drivers/net/wireless/ath/ath12k/pci.c
> +++ b/drivers/net/wireless/ath/ath12k/pci.c
> @@ -313,6 +313,19 @@ static void ath12k_pci_sw_reset(struct ath12k_base *ab, bool power_on)
>  	ath12k_mhi_set_mhictrl_reset(ab);
>  }
>  
> +static void ath12k_pci_free_ce_irq(struct ath12k_base *ab, int num_ce)
> +{
> +	int i, irq_idx;
> +
> +	for (i = 0; i < num_ce; i++) {
> +		if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR)
> +			continue;
> +
> +		irq_idx = ATH12K_PCI_IRQ_CE0_OFFSET + i;
> +		free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]);
> +	}
> +}
> +
>  static void ath12k_pci_free_ext_irq(struct ath12k_base *ab)
>  {
>  	int i, j;
> @@ -330,15 +343,7 @@ static void ath12k_pci_free_ext_irq(struct ath12k_base *ab)
>  
>  static void ath12k_pci_free_irq(struct ath12k_base *ab)
>  {
> -	int i, irq_idx;
> -
> -	for (i = 0; i < ab->hw_params->ce_count; i++) {
> -		if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR)
> -			continue;
> -		irq_idx = ATH12K_PCI_IRQ_CE0_OFFSET + i;
> -		free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]);
> -	}
> -
> +	ath12k_pci_free_ce_irq(ab, ab->hw_params->ce_count);
>  	ath12k_pci_free_ext_irq(ab);
>  }
>  
> @@ -671,6 +676,8 @@ static int ath12k_pci_config_irq(struct ath12k_base *ab)
>  		if (ret) {
>  			ath12k_err(ab, "failed to request irq %d: %d\n",
>  				   irq_idx, ret);
> +
> +			ath12k_pci_free_ce_irq(ab, i);
>  			return ret;
>  		}
>  
> @@ -681,8 +688,10 @@ static int ath12k_pci_config_irq(struct ath12k_base *ab)
>  	}
>  
>  	ret = ath12k_pci_ext_irq_config(ab);
> -	if (ret)
> +	if (ret) {
> +		ath12k_pci_ce_irq_disable(ab, ab->hw_params->ce_count);

ath12k_pci_free_ce_irq() instead ?

>  		return ret;
> +	}
>  
>  	return 0;
>  }


  reply	other threads:[~2026-08-19 10:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19  6:54 [PATCH ath-next 0/2] wifi: ath12k: Fix IRQ cleanup on PCI IRQ configuration failure Aaradhana Sahu
2026-08-19  6:54 ` [PATCH ath-next 1/2] wifi: ath12k: Free allocated CE IRQs on request_irq() failure Aaradhana Sahu
2026-08-19 10:13   ` Baochen Qiang [this message]
2026-08-19 10:20     ` Aaradhana Sahu
2026-08-19  6:54 ` [PATCH ath-next 2/2] wifi: ath12k: Free allocated external " Aaradhana Sahu

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=3be7c1ed-6298-4d85-bb47-3bd0337eca6a@oss.qualcomm.com \
    --to=baochen.qiang@oss.qualcomm.com \
    --cc=aaradhana.sahu@oss.qualcomm.com \
    --cc=ath12k@lists.infradead.org \
    --cc=jjohnson@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_kiranv@quicinc.com \
    --cc=vasanthakumar.thiagarajan@oss.qualcomm.com \
    /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