mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: atlantic: only free the PTP IRQ after a successful request
@ 2026-09-30  7:40 Runyu Xiao
  2026-09-30  7:44 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: Runyu Xiao @ 2026-09-30  7:40 UTC (permalink / raw)
  To: Sukhdeep Singh
  Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Richard Cochran, netdev, linux-kernel, stable,
	Runyu Xiao, Jianhao Xu

aq_nic_start() requests the PTP IRQ before it finishes the rest of the NIC
startup sequence. A later startup failure reaches aq_nic_stop(), which
calls aq_ptp_irq_free() even when aq_ptp_irq_alloc() skipped request_irq()
or when request_irq() failed.

Track whether the PTP IRQ request succeeded. Only call free_irq() after a
matching request_irq().

Fixes: 04a1839950d9 ("net: aquantia: implement data PTP datapath")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
 drivers/net/ethernet/aquantia/atlantic/aq_ptp.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
index 558ac9237..a5b69f1c7 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
@@ -84,6 +84,7 @@ struct aq_ptp_s {
 	struct ptp_tx_timeout ptp_tx_timeout;
 
 	unsigned int idx_ptp_vector;
+	bool irq_allocated;
 	struct napi_struct napi;
 
 	struct aq_ring_s ptp_tx;
@@ -1033,6 +1034,8 @@ int aq_ptp_irq_alloc(struct aq_nic_s *aq_nic)
 	if (pdev->msix_enabled || pdev->msi_enabled) {
 		err = request_irq(pci_irq_vector(pdev, aq_ptp->idx_ptp_vector),
 				  aq_ptp_isr, 0, aq_nic->ndev->name, aq_ptp);
+		if (!err)
+			aq_ptp->irq_allocated = true;
 	} else {
 		err = -EINVAL;
 		goto err_exit;
@@ -1050,7 +1053,11 @@ void aq_ptp_irq_free(struct aq_nic_s *aq_nic)
 	if (!aq_ptp)
 		return;
 
+	if (!aq_ptp->irq_allocated)
+		return;
+
 	free_irq(pci_irq_vector(pdev, aq_ptp->idx_ptp_vector), aq_ptp);
+	aq_ptp->irq_allocated = false;
 }
 
 int aq_ptp_ring_init(struct aq_nic_s *aq_nic)
-- 
2.34.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-30  7:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-30  7:40 [PATCH] net: atlantic: only free the PTP IRQ after a successful request Runyu Xiao
2026-09-30  7:44 ` netdev-bot+sinfo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®