wusb: return -ENOTCONN when resetting a port with no connected device
If reading the device descriptor fails during hub_port_init() fails, then the port is disabled, disconnecting the device. The port is then reset at the start of the next init attempt but there is no device to reset. Signed-off-by: David Vrabel <david.vrabel@csr.com>
This commit is contained in:
Родитель
2226b1c219
Коммит
9a9b1d17ba
|
@ -386,6 +386,7 @@ static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc,
|
||||||
| USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED);
|
| USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED);
|
||||||
port->change |= USB_PORT_STAT_C_CONNECTION | USB_PORT_STAT_C_ENABLE;
|
port->change |= USB_PORT_STAT_C_CONNECTION | USB_PORT_STAT_C_ENABLE;
|
||||||
if (wusb_dev) {
|
if (wusb_dev) {
|
||||||
|
dev_dbg(wusbhc->dev, "disconnecting device from port %d\n", wusb_dev->port_idx);
|
||||||
if (!list_empty(&wusb_dev->cack_node))
|
if (!list_empty(&wusb_dev->cack_node))
|
||||||
list_del_init(&wusb_dev->cack_node);
|
list_del_init(&wusb_dev->cack_node);
|
||||||
/* For the one in cack_add() */
|
/* For the one in cack_add() */
|
||||||
|
|
|
@ -100,6 +100,9 @@ static int wusbhc_rh_port_reset(struct wusbhc *wusbhc, u8 port_idx)
|
||||||
struct wusb_port *port = wusb_port_by_idx(wusbhc, port_idx);
|
struct wusb_port *port = wusb_port_by_idx(wusbhc, port_idx);
|
||||||
struct wusb_dev *wusb_dev = port->wusb_dev;
|
struct wusb_dev *wusb_dev = port->wusb_dev;
|
||||||
|
|
||||||
|
if (wusb_dev == NULL)
|
||||||
|
return -ENOTCONN;
|
||||||
|
|
||||||
port->status |= USB_PORT_STAT_RESET;
|
port->status |= USB_PORT_STAT_RESET;
|
||||||
port->change |= USB_PORT_STAT_C_RESET;
|
port->change |= USB_PORT_STAT_C_RESET;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче