The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] wifi: rtlwifi: pci: fix error path in rtl_pci_probe()
@ 2026-07-22 11:52 Abdun Nihaal
  2026-07-23  0:37 ` Ping-Ke Shih
  0 siblings, 1 reply; 2+ messages in thread
From: Abdun Nihaal @ 2026-07-22 11:52 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() and ieee80211_register_hw() 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.

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

diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c
index 73018a0498b4..98365176a901 100644
--- a/drivers/net/wireless/realtek/rtlwifi/pci.c
+++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
@@ -2227,13 +2227,16 @@ 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);
+	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] wifi: rtlwifi: pci: fix error path in rtl_pci_probe()
  2026-07-22 11:52 [PATCH] wifi: rtlwifi: pci: fix error path in rtl_pci_probe() Abdun Nihaal
@ 2026-07-23  0:37 ` Ping-Ke Shih
  0 siblings, 0 replies; 2+ messages in thread
From: Ping-Ke Shih @ 2026-07-23  0:37 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() and ieee80211_register_hw() 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.
> 
>  drivers/net/wireless/realtek/rtlwifi/pci.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c
> b/drivers/net/wireless/realtek/rtlwifi/pci.c
> index 73018a0498b4..98365176a901 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/pci.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
> @@ -2227,13 +2227,16 @@ 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	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-23  0:38 UTC | newest]

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

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