Blame 0010-usb-assert-on-calling-usb_attach-port-NULL-on-a-port.patch
|
Hans de Goede |
3f1f29 |
From a7466b2ff8e1cbdf3abf08a935c3b6c19303ffc2 Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
3f1f29 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
Hans de Goede |
3f1f29 |
Date: Fri, 24 Jun 2011 14:26:18 +0200
|
|
Hans de Goede |
3f1f29 |
Subject: [PATCH 10/35] usb: assert on calling usb_attach(port, NULL) on a
|
|
Hans de Goede |
3f1f29 |
port without a dev
|
|
Hans de Goede |
3f1f29 |
|
|
Hans de Goede |
3f1f29 |
with the "usb-ehci: cleanup port reset handling" patch in place no callers
|
|
Hans de Goede |
3f1f29 |
are calling usb_attach(port, NULL) for a port where port->dev is NULL.
|
|
Hans de Goede |
3f1f29 |
|
|
Hans de Goede |
3f1f29 |
Doing that makes no sense as that causes the port detach op to get called
|
|
Hans de Goede |
3f1f29 |
for a port with nothing attached. Add an assert that port->dev != NULL when
|
|
Hans de Goede |
3f1f29 |
dev == NULL, and remove the check for not having a port->dev in the dev == NULL
|
|
Hans de Goede |
3f1f29 |
case.
|
|
Hans de Goede |
3f1f29 |
|
|
Hans de Goede |
3f1f29 |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Hans de Goede |
3f1f29 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Hans de Goede |
3f1f29 |
---
|
|
Hans de Goede |
3f1f29 |
hw/usb.c | 9 ++++-----
|
|
Hans de Goede |
3f1f29 |
1 files changed, 4 insertions(+), 5 deletions(-)
|
|
Hans de Goede |
3f1f29 |
|
|
Hans de Goede |
3f1f29 |
diff --git a/hw/usb.c b/hw/usb.c
|
|
Hans de Goede |
3f1f29 |
index 735ffd1..27a983c 100644
|
|
Hans de Goede |
3f1f29 |
--- a/hw/usb.c
|
|
Hans de Goede |
3f1f29 |
+++ b/hw/usb.c
|
|
Hans de Goede |
3f1f29 |
@@ -40,12 +40,11 @@ void usb_attach(USBPort *port, USBDevice *dev)
|
|
Hans de Goede |
3f1f29 |
} else {
|
|
Hans de Goede |
3f1f29 |
/* detach */
|
|
Hans de Goede |
3f1f29 |
dev = port->dev;
|
|
Hans de Goede |
3f1f29 |
+ assert(dev);
|
|
Hans de Goede |
3f1f29 |
port->ops->detach(port);
|
|
Hans de Goede |
3f1f29 |
- if (dev) {
|
|
Hans de Goede |
3f1f29 |
- usb_send_msg(dev, USB_MSG_DETACH);
|
|
Hans de Goede |
3f1f29 |
- dev->port = NULL;
|
|
Hans de Goede |
3f1f29 |
- port->dev = NULL;
|
|
Hans de Goede |
3f1f29 |
- }
|
|
Hans de Goede |
3f1f29 |
+ usb_send_msg(dev, USB_MSG_DETACH);
|
|
Hans de Goede |
3f1f29 |
+ dev->port = NULL;
|
|
Hans de Goede |
3f1f29 |
+ port->dev = NULL;
|
|
Hans de Goede |
3f1f29 |
}
|
|
Hans de Goede |
3f1f29 |
}
|
|
Hans de Goede |
3f1f29 |
|
|
Hans de Goede |
3f1f29 |
--
|
|
Hans de Goede |
3f1f29 |
1.7.5.1
|
|
Hans de Goede |
3f1f29 |
|