r8152: fix unknown device for choose_configuration
authorHayes Wang <hayeswang@realtek.com>
Fri, 8 Mar 2024 07:52:06 +0000 (15:52 +0800)
committerJakub Kicinski <kuba@kernel.org>
Mon, 11 Mar 2024 21:12:16 +0000 (14:12 -0700)
For the unknown device, rtl8152_cfgselector_choose_configuration()
should return a negative value. Then, usb_choose_configuration() would
set a configuration for CDC ECM or NCM mode. Otherwise, there is no
usb interface driver for the device.

Fixes: aa4f2b3e418e ("r8152: Choose our USB config with choose_configuration() rather than probe()")
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Link: https://lore.kernel.org/r/20240308075206.33553-436-nic_swsd@realtek.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/usb/r8152.c

index 0d0672d2a65457748a77f1a39e5507773a33c2fb..51fe00c2b896e847a04b49c01810767f85754dfa 100644 (file)
@@ -10078,7 +10078,7 @@ static int rtl8152_cfgselector_choose_configuration(struct usb_device *udev)
         * driver supports it.
         */
        if (__rtl_get_hw_ver(udev) == RTL_VER_UNKNOWN)
-               return 0;
+               return -ENODEV;
 
        /* The vendor mode is not always config #1, so to find it out. */
        c = udev->config;