All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] wifi: rtlwifi: pci: fix error path in rtl_pci_probe()
@ 2026-07-23 12:01 Abdun Nihaal
  2026-07-24  9:07 ` Ping-Ke Shih
  0 siblings, 1 reply; 2+ messages in thread
From: Abdun Nihaal @ 2026-07-23 12:01 UTC (permalink / raw)
  To: pkshih; +Cc: Abdun Nihaal, linux-wireless, linux-kernel

In the last error path in rtl_pci_probe(), the cleanup functions are
skipped due to a wrong goto label. Moreover, the successful call to
rtl_init_rfkill(), ieee80211_register_hw(), rtl_debug_add_one() have to
be reverted. Fix this issue by updating the labels and adding the
relevant cleanup functions to the last error path.

Fixes: 0c8173385e54 ("rtl8192ce: Add new driver")
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
Compile tested only. Issue found using static analysis.

v1->v2:
- Added a call to rtl_debug_remove_one() in the error path, as suggested
  by Ping-Ke Shih, to free the debugfs resources which were successfully
  allocated in that path.
- Updated commit message to mention rtl_debug_add_one()

v1 link: https://patchwork.kernel.org/project/linux-wireless/patch/20260722115217.131458-1-nihaal@cse.iitm.ac.in/

 drivers/net/wireless/realtek/rtlwifi/pci.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c
index 73018a0498b4..de74ff8f6eee 100644
--- a/drivers/net/wireless/realtek/rtlwifi/pci.c
+++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
@@ -2227,13 +2227,17 @@ int rtl_pci_probe(struct pci_dev *pdev,
 		rtl_dbg(rtlpriv, COMP_INIT, DBG_DMESG,
 			"%s: failed to register IRQ handler\n",
 			wiphy_name(hw->wiphy));
-		goto fail3;
+		goto fail6;
 	}
 	rtlpci->irq_alloc = 1;
 
 	set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
 	return 0;
 
+fail6:
+	rtl_deinit_rfkill(hw);
+	rtl_debug_remove_one(hw);
+	ieee80211_unregister_hw(hw);
 fail5:
 	rtl_pci_deinit(hw);
 fail4:
-- 
2.43.0


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

* RE: [PATCH v2] wifi: rtlwifi: pci: fix error path in rtl_pci_probe()
  2026-07-23 12:01 [PATCH v2] wifi: rtlwifi: pci: fix error path in rtl_pci_probe() Abdun Nihaal
@ 2026-07-24  9:07 ` Ping-Ke Shih
  0 siblings, 0 replies; 2+ messages in thread
From: Ping-Ke Shih @ 2026-07-24  9:07 UTC (permalink / raw)
  To: Abdun Nihaal; +Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org

Abdun Nihaal <nihaal@cse.iitm.ac.in> wrote:
> In the last error path in rtl_pci_probe(), the cleanup functions are
> skipped due to a wrong goto label. Moreover, the successful call to
> rtl_init_rfkill(), ieee80211_register_hw(), rtl_debug_add_one() have to
> be reverted. Fix this issue by updating the labels and adding the
> relevant cleanup functions to the last error path.
> 
> Fixes: 0c8173385e54 ("rtl8192ce: Add new driver")
> Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>



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

end of thread, other threads:[~2026-07-24  9:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-23 12:01 [PATCH v2] wifi: rtlwifi: pci: fix error path in rtl_pci_probe() Abdun Nihaal
2026-07-24  9:07 ` Ping-Ke Shih

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.