@@ -151,6 +151,10 @@ int usb_device_supports_lpm(struct usb_device *udev)
151
151
if (udev -> quirks & USB_QUIRK_NO_LPM )
152
152
return 0 ;
153
153
154
+ /* Skip if the device BOS descriptor couldn't be read */
155
+ if (!udev -> bos )
156
+ return 0 ;
157
+
154
158
/* USB 2.1 (and greater) devices indicate LPM support through
155
159
* their USB 2.0 Extended Capabilities BOS descriptor.
156
160
*/
@@ -327,6 +331,10 @@ static void usb_set_lpm_parameters(struct usb_device *udev)
327
331
if (!udev -> lpm_capable || udev -> speed < USB_SPEED_SUPER )
328
332
return ;
329
333
334
+ /* Skip if the device BOS descriptor couldn't be read */
335
+ if (!udev -> bos )
336
+ return ;
337
+
330
338
hub = usb_hub_to_struct_hub (udev -> parent );
331
339
/* It doesn't take time to transition the roothub into U0, since it
332
340
* doesn't have an upstream link.
@@ -2704,13 +2712,17 @@ int usb_authorize_device(struct usb_device *usb_dev)
2704
2712
static enum usb_ssp_rate get_port_ssp_rate (struct usb_device * hdev ,
2705
2713
u32 ext_portstatus )
2706
2714
{
2707
- struct usb_ssp_cap_descriptor * ssp_cap = hdev -> bos -> ssp_cap ;
2715
+ struct usb_ssp_cap_descriptor * ssp_cap ;
2708
2716
u32 attr ;
2709
2717
u8 speed_id ;
2710
2718
u8 ssac ;
2711
2719
u8 lanes ;
2712
2720
int i ;
2713
2721
2722
+ if (!hdev -> bos )
2723
+ goto out ;
2724
+
2725
+ ssp_cap = hdev -> bos -> ssp_cap ;
2714
2726
if (!ssp_cap )
2715
2727
goto out ;
2716
2728
@@ -4215,8 +4227,15 @@ static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev,
4215
4227
enum usb3_link_state state )
4216
4228
{
4217
4229
int timeout ;
4218
- __u8 u1_mel = udev -> bos -> ss_cap -> bU1devExitLat ;
4219
- __le16 u2_mel = udev -> bos -> ss_cap -> bU2DevExitLat ;
4230
+ __u8 u1_mel ;
4231
+ __le16 u2_mel ;
4232
+
4233
+ /* Skip if the device BOS descriptor couldn't be read */
4234
+ if (!udev -> bos )
4235
+ return ;
4236
+
4237
+ u1_mel = udev -> bos -> ss_cap -> bU1devExitLat ;
4238
+ u2_mel = udev -> bos -> ss_cap -> bU2DevExitLat ;
4220
4239
4221
4240
/* If the device says it doesn't have *any* exit latency to come out of
4222
4241
* U1 or U2, it's probably lying. Assume it doesn't implement that link
0 commit comments