netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v3] r8152: add error handling in rtl8152_driver_init
@ 2025-10-11  8:24 yicongsrfy
  2025-10-16  0:20 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: yicongsrfy @ 2025-10-11  8:24 UTC (permalink / raw)
  To: andrew+netdev, davem, edumazet, oneukum
  Cc: horms, kuba, linux-usb, netdev, stable, Yi Cong

From: Yi Cong <yicong@kylinos.cn>

rtl8152_driver_init missing error handling.
If cannot register rtl8152_driver, rtl8152_cfgselector_driver
should be deregistered.

Fixes: ec51fbd1b8a2 ("r8152: add USB device driver for config selection")
Cc: stable@vger.kernel.org
Signed-off-by: Yi Cong <yicong@kylinos.cn>
Reviewed-by: Simon Horman <horms@kernel.org>

---
v2: replacing return 0 with return ret and adding Cc stable
v3: delete the redundant return ret
---
 drivers/net/usb/r8152.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 44cba7acfe7d..a22d4bb2cf3b 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -10122,7 +10122,12 @@ static int __init rtl8152_driver_init(void)
 	ret = usb_register_device_driver(&rtl8152_cfgselector_driver, THIS_MODULE);
 	if (ret)
 		return ret;
-	return usb_register(&rtl8152_driver);
+
+	ret = usb_register(&rtl8152_driver);
+	if (ret)
+		usb_deregister_device_driver(&rtl8152_cfgselector_driver);
+
+	return ret;
 }
 
 static void __exit rtl8152_driver_exit(void)
-- 
2.25.1


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

* Re: [PATCH net v3] r8152: add error handling in rtl8152_driver_init
  2025-10-11  8:24 [PATCH net v3] r8152: add error handling in rtl8152_driver_init yicongsrfy
@ 2025-10-16  0:20 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2025-10-16  0:20 UTC (permalink / raw)
  To: yicongsrfy
  Cc: andrew+netdev, davem, edumazet, oneukum, horms, linux-usb, netdev,
	stable, Yi Cong

On Sat, 11 Oct 2025 16:24:15 +0800 yicongsrfy@163.com wrote:
> From: Yi Cong <yicong@kylinos.cn>
> 
> rtl8152_driver_init missing error handling.
> If cannot register rtl8152_driver, rtl8152_cfgselector_driver
> should be deregistered.

This has been (silently) applied on Tue, thanks!

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

end of thread, other threads:[~2025-10-16  0:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-11  8:24 [PATCH net v3] r8152: add error handling in rtl8152_driver_init yicongsrfy
2025-10-16  0:20 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).