Netdev List
 help / color / mirror / Atom feed
* [PATCH net] r8152: handle the return value of usb_reset_device()
@ 2026-06-04  9:22 Chih Kai Hsu
  2026-06-04  9:28 ` Hayes Wang
  2026-06-04 12:53 ` Andrew Lunn
  0 siblings, 2 replies; 6+ messages in thread
From: Chih Kai Hsu @ 2026-06-04  9:22 UTC (permalink / raw)
  To: kuba, davem; +Cc: netdev, nic_swsd, linux-kernel, linux-usb, Chih Kai Hsu

If usb_reset_device() returns a negative error code, stop the
process of probing.

Fixes: 10c3271712f5 ("r8152: disable the ECM mode")
Signed-off-by: Chih Kai Hsu <hsu.chih.kai@realtek.com>
---
 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 1ace1d2398c9..b1268553cd70 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -9851,7 +9851,12 @@ static int rtl8152_probe_once(struct usb_interface *intf,
 	struct net_device *netdev;
 	int ret;
 
-	usb_reset_device(udev);
+	ret = usb_reset_device(udev);
+	if (ret < 0) {
+		dev_err(&intf->dev, "USB reset failed, errno=%d\n", ret);
+		return ret;
+	}
+
 	netdev = alloc_etherdev(sizeof(struct r8152));
 	if (!netdev) {
 		dev_err(&intf->dev, "Out of memory\n");
-- 
2.34.1


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

* RE: [PATCH net] r8152: handle the return value of usb_reset_device()
  2026-06-04  9:22 [PATCH net] r8152: handle the return value of usb_reset_device() Chih Kai Hsu
@ 2026-06-04  9:28 ` Hayes Wang
  2026-06-04 12:53 ` Andrew Lunn
  1 sibling, 0 replies; 6+ messages in thread
From: Hayes Wang @ 2026-06-04  9:28 UTC (permalink / raw)
  To: Chih Kai Hsu, kuba@kernel.org, davem@davemloft.net
  Cc: netdev@vger.kernel.org, nic_swsd, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org, Chih Kai Hsu

Chih Kai Hsu <hsu.chih.kai@realtek.com>
> Sent: Thursday, June 4, 2026 5:23 PM
> To: kuba@kernel.org; davem@davemloft.net
> Cc: netdev@vger.kernel.org; nic_swsd <nic_swsd@realtek.com>;
> linux-kernel@vger.kernel.org; linux-usb@vger.kernel.org; Chih Kai Hsu
> <hsu.chih.kai@realtek.com>
> Subject: [PATCH net] r8152: handle the return value of usb_reset_device()
> 
> If usb_reset_device() returns a negative error code, stop the process of
> probing.
> 
> Fixes: 10c3271712f5 ("r8152: disable the ECM mode")
> Signed-off-by: Chih Kai Hsu <hsu.chih.kai@realtek.com>

Reviewed-by: Hayes Wang <hayeswang@realtek.com>

Best Regards,
Hayes


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

* Re: [PATCH net] r8152: handle the return value of usb_reset_device()
  2026-06-04  9:22 [PATCH net] r8152: handle the return value of usb_reset_device() Chih Kai Hsu
  2026-06-04  9:28 ` Hayes Wang
@ 2026-06-04 12:53 ` Andrew Lunn
  2026-06-05  2:42   ` Chih Kai Hsu
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2026-06-04 12:53 UTC (permalink / raw)
  To: Chih Kai Hsu; +Cc: kuba, davem, netdev, nic_swsd, linux-kernel, linux-usb

On Thu, Jun 04, 2026 at 05:22:47PM +0800, Chih Kai Hsu wrote:
> If usb_reset_device() returns a negative error code, stop the
> process of probing.
> 
> Fixes: 10c3271712f5 ("r8152: disable the ECM mode")

https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html

Does this bother people?

	Andrew

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

* RE: [PATCH net] r8152: handle the return value of usb_reset_device()
  2026-06-04 12:53 ` Andrew Lunn
@ 2026-06-05  2:42   ` Chih Kai Hsu
  2026-06-05  4:03     ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Chih Kai Hsu @ 2026-06-05  2:42 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: kuba@kernel.org, davem@davemloft.net, netdev@vger.kernel.org,
	nic_swsd, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org

On 04/06/26 8:54 pm, Andrew Lunn wrote:

> On Thu, Jun 04, 2026 at 05:22:47PM +0800, Chih Kai Hsu wrote:
> > If usb_reset_device() returns a negative error code, stop the process
> > of probing.
> >
> > Fixes: 10c3271712f5 ("r8152: disable the ECM mode")
> 
> https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
> 
> Does this bother people?
Yes, it does.
If the driver does not return early when receiving an error code from usb_reset_device(),
the subsequent execution will trigger a kernel call trace.

> 
>         Andrew

Best Regards,
Chih Kai

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

* Re: [PATCH net] r8152: handle the return value of usb_reset_device()
  2026-06-05  2:42   ` Chih Kai Hsu
@ 2026-06-05  4:03     ` Andrew Lunn
  2026-06-05  6:26       ` Chih Kai Hsu
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2026-06-05  4:03 UTC (permalink / raw)
  To: Chih Kai Hsu
  Cc: kuba@kernel.org, davem@davemloft.net, netdev@vger.kernel.org,
	nic_swsd, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org

On Fri, Jun 05, 2026 at 02:42:34AM +0000, Chih Kai Hsu wrote:
> On 04/06/26 8:54 pm, Andrew Lunn wrote:
> 
> > On Thu, Jun 04, 2026 at 05:22:47PM +0800, Chih Kai Hsu wrote:
> > > If usb_reset_device() returns a negative error code, stop the process
> > > of probing.
> > >
> > > Fixes: 10c3271712f5 ("r8152: disable the ECM mode")
> > 
> > https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
> > 
> > Does this bother people?
> Yes, it does.
> If the driver does not return early when receiving an error code from usb_reset_device(),
> the subsequent execution will trigger a kernel call trace.

Please include a link to such a bug report, kernel call trace etc, to
to show it bothers somebody. Do you have the hardware and can trigger
this?

	Andrew

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

* RE: [PATCH net] r8152: handle the return value of usb_reset_device()
  2026-06-05  4:03     ` Andrew Lunn
@ 2026-06-05  6:26       ` Chih Kai Hsu
  0 siblings, 0 replies; 6+ messages in thread
From: Chih Kai Hsu @ 2026-06-05  6:26 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: kuba@kernel.org, davem@davemloft.net, netdev@vger.kernel.org,
	nic_swsd, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org

On 05/06/26 12:04 pm, Andrew Lunn wrote:

> On Fri, Jun 05, 2026 at 02:42:34AM +0000, Chih Kai Hsu wrote:
> > On 04/06/26 8:54 pm, Andrew Lunn wrote:
> >
> > > On Thu, Jun 04, 2026 at 05:22:47PM +0800, Chih Kai Hsu wrote:
> > > > If usb_reset_device() returns a negative error code, stop the
> > > > process of probing.
> > > >
> > > > Fixes: 10c3271712f5 ("r8152: disable the ECM mode")
> > >
> > > https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.h
> > > tml
> > >
> > > Does this bother people?
> > Yes, it does.
> > If the driver does not return early when receiving an error code from
> > usb_reset_device(), the subsequent execution will trigger a kernel call trace.
> 
> Please include a link to such a bug report, kernel call trace etc, to to show it
> bothers somebody. Do you have the hardware and can trigger this?

If the driver ignores the error from usb_reset_device(), I get the following call trace.

[ 2405.758846] Call Trace:
[ 2405.758853]  <TASK>
[ 2405.758872]  usb_probe_interface+0x15b/0x350
[ 2405.758895]  really_probe+0xdb/0x340
[ 2405.758910]  ? pm_runtime_barrier+0x55/0x90
[ 2405.758926]  __driver_probe_device+0x78/0x140
[ 2405.758940]  driver_probe_device+0x1f/0xa0
[ 2405.75895s3]  ? __pfx___driver_attach+0x10/0x10
[ 2405.758965]  __driver_attach+0xcb/0x1e0
[ 2405.758979]  bus_for_each_dev+0x82/0xd0
[ 2405.758992]  bus_add_driver+0x12f/0x210
[ 2405.759035]  ? __pfx_rtl8152_driver_init+0x10/0x10 [r8152]
[ 2405.759069]  driver_register+0x75/0xe0
[ 2405.759079]  usb_register_driver+0x99/0x150
[ 2405.759092]  ? usb_register_device_driver.cold+0x3a/0x40
[ 2405.759107]  do_one_initcall+0x58/0x300
[ 2405.759124]  do_init_module+0x84/0x280
[ 2405.759138]  init_module_from_file+0x8a/0xe0
[ 2405.759160]  idempotent_init_module+0x114/0x310
[ 2405.759178]  __x64_sys_finit_module+0x6d/0xd0
[ 2405.759190]  ? syscall_trace_enter+0x173/0x1f0
[ 2405.759205]  do_syscall_64+0x7e/0x250
[ 2405.759216]  ? syscall_exit_work+0xb0/0x1b0
[ 2405.759228]  ? do_syscall_64+0xb6/0x250
[ 2405.759239]  ? count_memcg_events+0x15d/0x230
[ 2405.759251]  ? handle_mm_fault+0x248/0x360
[ 2405.759264]  ? do_user_addr_fault+0x21a/0x690
[ 2405.759278]  ? irqentry_exit_to_user_mode+0x2c/0x1c0
[ 2405.759290]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
[ 2405.759300] RIP: 0033:0x7f7fa09010cd
[ 2405.759335] Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 03 4d 0f 00 f7 d8 64 89 01 48
[ 2405.759344] RSP: 002b:00007fff7deaa418 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[ 2405.759356] RAX: ffffffffffffffda RBX: 0000555bbeb58750 RCX: 00007f7fa09010cd
[ 2405.759362] RDX: 0000000000000000 RSI: 0000555bb09c65ee RDI: 0000000000000003
[ 2405.759368] RBP: 00007fff7deaa4d0 R08: 0000000000000000 R09: 00007fff7deaa460
[ 2405.759375] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
[ 2405.759380] R13: 0000555bbeb583c0 R14: 0000555bb09c65ee R15: 0000000000000000
[ 2405.759395]  </TASK>
[ 2405.759400] ---[ end trace 0000000000000000 ]---

> 
>         Andrew

Best Regards,
Chih-Kai

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

end of thread, other threads:[~2026-06-05  6:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04  9:22 [PATCH net] r8152: handle the return value of usb_reset_device() Chih Kai Hsu
2026-06-04  9:28 ` Hayes Wang
2026-06-04 12:53 ` Andrew Lunn
2026-06-05  2:42   ` Chih Kai Hsu
2026-06-05  4:03     ` Andrew Lunn
2026-06-05  6:26       ` Chih Kai Hsu

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