aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/message.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-23 23:44:19 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-23 23:44:19 -0500
commit1ebbe2b20091d306453a5cf480a87e6cd28ae76f (patch)
treef5cd7a0fa69b8b1938cb5a0faed2e7b0628072a5 /drivers/usb/core/message.c
parentac58c9059da8886b5e8cde012a80266b18ca146e (diff)
parent674a396c6d2ba0341ebdd7c1c9950f32f018e2dd (diff)
Merge branch 'linus'
Diffstat (limited to 'drivers/usb/core/message.c')
-rw-r--r--drivers/usb/core/message.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 7135e542679d..08fb20f06f3e 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -631,8 +631,8 @@ int usb_get_descriptor(struct usb_device *dev, unsigned char type, unsigned char
631 * Returns the number of bytes received on success, or else the status code 631 * Returns the number of bytes received on success, or else the status code
632 * returned by the underlying usb_control_msg() call. 632 * returned by the underlying usb_control_msg() call.
633 */ 633 */
634int usb_get_string(struct usb_device *dev, unsigned short langid, 634static int usb_get_string(struct usb_device *dev, unsigned short langid,
635 unsigned char index, void *buf, int size) 635 unsigned char index, void *buf, int size)
636{ 636{
637 int i; 637 int i;
638 int result; 638 int result;
@@ -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,
@@ -1488,7 +1490,6 @@ EXPORT_SYMBOL(usb_sg_wait);
1488// synchronous control message convenience routines 1490// synchronous control message convenience routines
1489EXPORT_SYMBOL(usb_get_descriptor); 1491EXPORT_SYMBOL(usb_get_descriptor);
1490EXPORT_SYMBOL(usb_get_status); 1492EXPORT_SYMBOL(usb_get_status);
1491EXPORT_SYMBOL(usb_get_string);
1492EXPORT_SYMBOL(usb_string); 1493EXPORT_SYMBOL(usb_string);
1493 1494
1494// synchronous calls that also maintain usbcore state 1495// synchronous calls that also maintain usbcore state