aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/composite.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r--drivers/usb/gadget/composite.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index f79fdb839cb8..f2da0269e1b1 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -245,7 +245,7 @@ static int config_buf(struct usb_configuration *config,
245 c->bConfigurationValue = config->bConfigurationValue; 245 c->bConfigurationValue = config->bConfigurationValue;
246 c->iConfiguration = config->iConfiguration; 246 c->iConfiguration = config->iConfiguration;
247 c->bmAttributes = USB_CONFIG_ATT_ONE | config->bmAttributes; 247 c->bmAttributes = USB_CONFIG_ATT_ONE | config->bmAttributes;
248 c->bMaxPower = config->bMaxPower; 248 c->bMaxPower = config->bMaxPower ? : (CONFIG_USB_GADGET_VBUS_DRAW / 2);
249 249
250 /* There may be e.g. OTG descriptors */ 250 /* There may be e.g. OTG descriptors */
251 if (config->descriptors) { 251 if (config->descriptors) {
@@ -432,7 +432,7 @@ static int set_config(struct usb_composite_dev *cdev,
432 } 432 }
433 433
434 /* when we return, be sure our power usage is valid */ 434 /* when we return, be sure our power usage is valid */
435 power = 2 * c->bMaxPower; 435 power = c->bMaxPower ? (2 * c->bMaxPower) : CONFIG_USB_GADGET_VBUS_DRAW;
436done: 436done:
437 usb_gadget_vbus_draw(gadget, power); 437 usb_gadget_vbus_draw(gadget, power);
438 return result; 438 return result;