Re: [PATCH V5 8/8] usb : Add usb port's power control attributes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 3 Jul 2012, Lan Tianyu wrote:

> hi alan:
> 	I have done some experiments. I insert clear PORT_POWER in the 
> hub_port_connect_change()
> to simulate such situation. I found there is leak if I clear PORT_POWER in the 
> hub_port_connect_change()
> after hub_port_init() and before usb_new_device().
> 
> [    7.083502] xhci_hub_control: clear port power, actual port 1 status  = 0xe01
> [    7.090793] usb 1-2: unable to read config index 0 descriptor/start: -71
> [    7.097469] usb 1-2: chopping to 0 config(s)
> [    7.098898] ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
> [    7.107898] ata2.00: ATAPI: Optiarc BD ROM BC-5640H, 1.00, max UDMA/100
> [    7.107982] usb 1-2: string descriptor 0 read error: -71
> [    7.107988] usb 1-2: New USB device found, idVendor=0781, idProduct=5567
> [    7.107990] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> [    7.108144] usb 1-2: no configuration chosen from 0 choices
> In usb_get_configuration(),  usb_get_descriptor failed but not return err. The 
> device
> was still enumerated. I do following change and it works. Why here don't return err?

I don't remember the reason.  It may be that some devices are broken 
and don't just don't send some of their config descriptors correctly.

> diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
> index f4bdd0c..90f962b 100644
> --- a/drivers/usb/core/config.c
> +++ b/drivers/usb/core/config.c
> @@ -704,7 +704,7 @@ int usb_get_configuration(struct usb_device *dev)
>                              "descriptor/%s: %d\n", cfgno, "start", result);
>                          dev_err(ddev, "chopping to %d config(s)\n", cfgno);
>                          dev->descriptor.bNumConfigurations = cfgno;
> -                       break;
> +                       goto err;
>                  } else if (result < 4) {
>                          dev_err(ddev, "config index %d descriptor too short "
>                              "(expected %i, got %i)\n", cfgno,

Perhaps it would be best to do:

			dev_err(ddev, "chopping to %d config(s)\n", cfgno);
			dev->descriptor.bNumConfigurations = cfgno;
+			if (result != -EPIPE)
+				goto err;
			break;
		} else if (result < 4) {
			dev_err(ddev, "config index %d descriptor too short "

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux