@@ -148,6 +148,10 @@ int usb_device_supports_lpm(struct usb_device *udev)
148
148
if (udev -> quirks & USB_QUIRK_NO_LPM )
149
149
return 0 ;
150
150
151
+ /* Skip if the device BOS descriptor couldn't be read */
152
+ if (!udev -> bos )
153
+ return 0 ;
154
+
151
155
/* USB 2.1 (and greater) devices indicate LPM support through
152
156
* their USB 2.0 Extended Capabilities BOS descriptor.
153
157
*/
@@ -324,6 +328,10 @@ static void usb_set_lpm_parameters(struct usb_device *udev)
324
328
if (!udev -> lpm_capable || udev -> speed < USB_SPEED_SUPER )
325
329
return ;
326
330
331
+ /* Skip if the device BOS descriptor couldn't be read */
332
+ if (!udev -> bos )
333
+ return ;
334
+
327
335
hub = usb_hub_to_struct_hub (udev -> parent );
328
336
/* It doesn't take time to transition the roothub into U0, since it
329
337
* doesn't have an upstream link.
@@ -2679,7 +2687,8 @@ int usb_authorize_device(struct usb_device *usb_dev)
2679
2687
}
2680
2688
2681
2689
/*
2682
- * Return 1 if port speed is SuperSpeedPlus, 0 otherwise
2690
+ * Return 1 if port speed is SuperSpeedPlus, 0 otherwise or if the
2691
+ * capability couldn't be checked.
2683
2692
* check it from the link protocol field of the current speed ID attribute.
2684
2693
* current speed ID is got from ext port status request. Sublink speed attribute
2685
2694
* table is returned with the hub BOS SSP device capability descriptor
@@ -2689,8 +2698,12 @@ static int port_speed_is_ssp(struct usb_device *hdev, int speed_id)
2689
2698
int ssa_count ;
2690
2699
u32 ss_attr ;
2691
2700
int i ;
2692
- struct usb_ssp_cap_descriptor * ssp_cap = hdev -> bos -> ssp_cap ;
2701
+ struct usb_ssp_cap_descriptor * ssp_cap ;
2693
2702
2703
+ if (!hdev -> bos )
2704
+ return 0 ;
2705
+
2706
+ ssp_cap = hdev -> bos -> ssp_cap ;
2694
2707
if (!ssp_cap )
2695
2708
return 0 ;
2696
2709
@@ -4151,8 +4164,15 @@ static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev,
4151
4164
enum usb3_link_state state )
4152
4165
{
4153
4166
int timeout , ret ;
4154
- __u8 u1_mel = udev -> bos -> ss_cap -> bU1devExitLat ;
4155
- __le16 u2_mel = udev -> bos -> ss_cap -> bU2DevExitLat ;
4167
+ __u8 u1_mel ;
4168
+ __le16 u2_mel ;
4169
+
4170
+ /* Skip if the device BOS descriptor couldn't be read */
4171
+ if (!udev -> bos )
4172
+ return ;
4173
+
4174
+ u1_mel = udev -> bos -> ss_cap -> bU1devExitLat ;
4175
+ u2_mel = udev -> bos -> ss_cap -> bU2DevExitLat ;
4156
4176
4157
4177
/* If the device says it doesn't have *any* exit latency to come out of
4158
4178
* U1 or U2, it's probably lying. Assume it doesn't implement that link
0 commit comments