Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> wrote: > On 09/07/2024 03:55, Ping-Ke Shih wrote: > > Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> wrote: > >> On 08/07/2024 12:19, Ping-Ke Shih wrote: > >>> Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> wrote: > >>>> @@ -896,6 +972,14 @@ int rtw_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) > >>>> goto err_destroy_rxwq; > >>>> } > >>>> > >>>> + ret = rtw_usb_switch_mode(rtwdev); > >>>> + if (ret) { > >>>> + /* Not a fail, but we do need to skip rtw_register_hw. */ > >>>> + rtw_info(rtwdev, "switching to USB 3 mode\n"); > >>> > >>> All logs in this patches should be rtw_dbg(), because these messages are not > >>> important to users. > >>> > >> > >> Okay, I will add RTW_DBG_USB to enum rtw_debug_mask. > >> > >>> > >>>> + ret = 0; > > > > I missed this point "ret = 0" that rtw_usb_disconnect() will be called when > > USB disconnect. Can't we just return an error code? any negative effect? > > > > My point is to avoid calling rtw_usb_disconnect() for the case of switching > > USB 3, because all stuffs have been freed by following error handles. > > > > If we return an error code instead of 0, it still switches > to USB 3, but we get an error message: > > Jul 09 13:47:54 ideapad2 kernel: rtw_8812au 1-4:1.0: probe with driver rtw_8812au failed with error 1 > Got it. Let's take your method.