summaryrefslogtreecommitdiff
path: root/hw/usb-ehci.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-06-21 12:23:40 +0200
committerGerd Hoffmann <kraxel@redhat.com>2011-07-05 15:09:02 +0200
commitfbf9db645765a22b796e128967bebb64c073938a (patch)
treebb62231513bb61c2c887c4223e4783e5007bf02e /hw/usb-ehci.c
parentc44fd61c0f38aa7927fd41bd7e59cb3e60fd4d75 (diff)
downloadqemu-fbf9db645765a22b796e128967bebb64c073938a.tar.gz
usb-ehci: cleanup port reset handling
Doing a usb_attach when dev is NULL will just result in the port detach op getting called even though nothing was connected in the first place. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb-ehci.c')
-rw-r--r--hw/usb-ehci.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index ce1a432dd4..d85e0a9851 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -863,14 +863,9 @@ static void handle_port_status_write(EHCIState *s, int port, uint32_t val)
if (!(val & PORTSC_PRESET) &&(*portsc & PORTSC_PRESET)) {
trace_usb_ehci_port_reset(port, 0);
- usb_attach(&s->ports[port], dev);
-
- // TODO how to handle reset of ports with no device
if (dev) {
+ usb_attach(&s->ports[port], dev);
usb_send_msg(dev, USB_MSG_RESET);
- }
-
- if (s->ports[port].dev) {
*portsc &= ~PORTSC_CSC;
}