aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/message.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 2f6009b0cffc..08fb20f06f3e 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1388,11 +1388,13 @@ free_interfaces:
1388 if (dev->state != USB_STATE_ADDRESS) 1388 if (dev->state != USB_STATE_ADDRESS)
1389 usb_disable_device (dev, 1); // Skip ep0 1389 usb_disable_device (dev, 1); // Skip ep0
1390 1390
1391 i = dev->bus_mA - cp->desc.bMaxPower * 2; 1391 if (cp) {
1392 if (i < 0) 1392 i = dev->bus_mA - cp->desc.bMaxPower * 2;
1393 dev_warn(&dev->dev, "new config #%d exceeds power " 1393 if (i < 0)
1394 "limit by %dmA\n", 1394 dev_warn(&dev->dev, "new config #%d exceeds power "
1395 configuration, -i); 1395 "limit by %dmA\n",
1396 configuration, -i);
1397 }
1396 1398
1397 if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 1399 if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
1398 USB_REQ_SET_CONFIGURATION, 0, configuration, 0, 1400 USB_REQ_SET_CONFIGURATION, 0, configuration, 0,