* [PATCH] net: usb: r8152: add error handling in rtl8152_driver_init
@ 2025-10-09 7:58 yicongsrfy
2025-10-09 8:52 ` Simon Horman
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: yicongsrfy @ 2025-10-09 7:58 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, oneukum; +Cc: kuba, linux-usb, netdev, yicong
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")
Signed-off-by: Yi Cong <yicong@kylinos.cn>
---
drivers/net/usb/r8152.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 44cba7acfe7d..a64bcb744fad 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -10122,7 +10122,14 @@ 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;
+ }
+
+ return 0;
}
static void __exit rtl8152_driver_exit(void)
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: usb: r8152: add error handling in rtl8152_driver_init
2025-10-09 7:58 [PATCH] net: usb: r8152: add error handling in rtl8152_driver_init yicongsrfy
@ 2025-10-09 8:52 ` Simon Horman
2025-10-09 9:54 ` Greg KH
2025-10-09 12:01 ` Andrew Lunn
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2025-10-09 8:52 UTC (permalink / raw)
To: yicongsrfy
Cc: andrew+netdev, davem, edumazet, oneukum, kuba, linux-usb, netdev,
yicong
On Thu, Oct 09, 2025 at 03:58:33PM +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.
>
> Fixes: ec51fbd1b8a2 ("r8152: add USB device driver for config selection")
> Signed-off-by: Yi Cong <yicong@kylinos.cn>
Thanks Yi Cong,
I agree that this addresses a bug.
And that the bug was introduced by the cited commit.
Reviewed-by: Simon Horman <horms@kernel.org>
Some points to keep in mind for future patch submissions.
(I don't think you need to repost because of these,
but others may think otherwise).
1. Please tag Networking patches with the target tree.
In this case, as a bug fix, that would be net.
Subject: [PATCH net] ...
Otherwise it would probably be net-next.
2. Git history is not entirely consistent here, but
I'd say that 'r8152:' is good prefix for this patch (less is more IMHO).
Subject: [PATCH net] r8152: ...
3. It is, TBH, not strictly followed for networking patches. But officially
bug fixes for stable should be CCed to stable@vger.kernel.org. Greg KH
tends to be CCed on such patches, and has a bot that complains about this.
4. Please generate the CC list using
./scripts/get_maintainer.pl this.patch
Perhaps with --git-min-percent=25
For more information see:
https://docs.kernel.org/process/maintainer-netdev.html
...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: usb: r8152: add error handling in rtl8152_driver_init
2025-10-09 7:58 [PATCH] net: usb: r8152: add error handling in rtl8152_driver_init yicongsrfy
2025-10-09 8:52 ` Simon Horman
@ 2025-10-09 9:54 ` Greg KH
2025-10-09 12:01 ` Andrew Lunn
2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2025-10-09 9:54 UTC (permalink / raw)
To: yicongsrfy
Cc: andrew+netdev, davem, edumazet, oneukum, kuba, linux-usb, netdev,
yicong
On Thu, Oct 09, 2025 at 03:58:33PM +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.
>
> Fixes: ec51fbd1b8a2 ("r8152: add USB device driver for config selection")
> Signed-off-by: Yi Cong <yicong@kylinos.cn>
> ---
> drivers/net/usb/r8152.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 44cba7acfe7d..a64bcb744fad 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -10122,7 +10122,14 @@ 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;
> + }
> +
> + return 0;
> }
>
> static void __exit rtl8152_driver_exit(void)
> --
> 2.25.1
>
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- You have marked a patch with a "Fixes:" tag for a commit that is in an
older released kernel, yet you do not have a cc: stable line in the
signed-off-by area at all, which means that the patch will not be
applied to any older kernel releases. To properly fix this, please
follow the documented rules in the
Documentation/process/stable-kernel-rules.rst file for how to resolve
this.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: usb: r8152: add error handling in rtl8152_driver_init
2025-10-09 7:58 [PATCH] net: usb: r8152: add error handling in rtl8152_driver_init yicongsrfy
2025-10-09 8:52 ` Simon Horman
2025-10-09 9:54 ` Greg KH
@ 2025-10-09 12:01 ` Andrew Lunn
2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2025-10-09 12:01 UTC (permalink / raw)
To: yicongsrfy
Cc: andrew+netdev, davem, edumazet, oneukum, kuba, linux-usb, netdev,
yicong
On Thu, Oct 09, 2025 at 03:58:33PM +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.
>
> Fixes: ec51fbd1b8a2 ("r8152: add USB device driver for config selection")
> Signed-off-by: Yi Cong <yicong@kylinos.cn>
> ---
> drivers/net/usb/r8152.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 44cba7acfe7d..a64bcb744fad 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -10122,7 +10122,14 @@ 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;
> + }
> +
> + return 0;
> }
You can make this slightly simpler by replacing return 0; with
return ret;
Andrew
---
pw-bot: cr
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-09 12:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-09 7:58 [PATCH] net: usb: r8152: add error handling in rtl8152_driver_init yicongsrfy
2025-10-09 8:52 ` Simon Horman
2025-10-09 9:54 ` Greg KH
2025-10-09 12:01 ` Andrew Lunn
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).