Skip to contentSkip to conversation

usb-bus: fix no params

PATCH Superseded TeLeMan 3 participants 4 messages Mar 19, 2010 – Mar 30, 2010

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

TeLeMan

author
#0 lore raw

PATCH 1/1 usb-bus: fix no params

The "params" is never NULL and the usb hid devices have no params.

---
 hw/usb-bus.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
hw/usb-bus.c +0 -4
index ce8a694..f3f1ed6 100644
@@ -299,10 +299,6 @@ USBDevice *usbdevice_create(const char *cmdline)
     }
 
     if (!usb->usbdevice_init) {
-        if (params) {
-            error_report("usbdevice %s accepts no params", driver);
-            return NULL;
-        }
         return usb_create_simple(bus, usb->qdev.name);
     }
     return usb->usbdevice_init(params);
Signature · 3 lines
1.6.5.1.1367.gcd48
--
SUN OF A BEACH
#1 lore raw
Quoted 1 line · TeLeMan

The "params" is never NULL and the usb hid devices have no params.

This looks plainly wrong. With your patch, usb devices which don't accept parameters, will accept and ignore them.

What are you trying to fix here?

Quoted 27 lines
---
 hw/usb-bus.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
hw/usb-bus.c +0 -4
index ce8a694..f3f1ed6 100644
@@ -299,10 +299,6 @@ USBDevice *usbdevice_create(const char *cmdline)
     }
 
     if (!usb->usbdevice_init) {
-        if (params) {
-            error_report("usbdevice %s accepts no params", driver);
-            return NULL;
-        }
         return usb_create_simple(bus, usb->qdev.name);
     }
     return usb->usbdevice_init(params);
Signature · 3 lines
1.6.5.1.1367.gcd48
--
SUN OF A BEACH
Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#2 lore raw

Am 27.03.2010 13:47, schrieb Aurelien Jarno:

Quoted 7 lines · TeLeMan
Quoted 1 line

The "params" is never NULL and the usb hid devices have no params.

This looks plainly wrong. With your patch, usb devices which don't accept parameters, will accept and ignore them.

What are you trying to fix here?

It looks like it's fixing -usbdevice tablet (and keyboard/mouse) which currently fails like this:

qemu-system-x86_64: usbdevice tablet accepts no params
qemu: could not add USB device 'tablet'

He's correct in that params is never NULL (if it was NULL it's set to an empty string some lines earlier, introduced by 702f3e0f), so usb_create_simple is never called. Maybe the right fix is to check for *params instead of params now?

Kevin

Quoted 29 lines
Quoted 28 lines
---
 hw/usb-bus.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
hw/usb-bus.c +0 -4
index ce8a694..f3f1ed6 100644
@@ -299,10 +299,6 @@ USBDevice *usbdevice_create(const char *cmdline)
     }
 
     if (!usb->usbdevice_init) {
-        if (params) {
-            error_report("usbdevice %s accepts no params", driver);
-            return NULL;
-        }
         return usb_create_simple(bus, usb->qdev.name);
     }
     return usb->usbdevice_init(params);
Signature · 3 lines
1.6.5.1.1367.gcd48
--
SUN OF A BEACH
author
#3 lore raw
Quoted 12 lines · Kevin Wolf

Am 27.03.2010 13:47, schrieb Aurelien Jarno:

Quoted 7 lines · TeLeMan
Quoted 1 line

The "params" is never NULL and the usb hid devices have no params.

This looks plainly wrong. With your patch, usb devices which don't accept parameters, will accept and ignore them.

What are you trying to fix here?

It looks like it's fixing -usbdevice tablet (and keyboard/mouse) which currently fails like this:

Quoted 7 lines

qemu-system-x86_64: usbdevice tablet accepts no params
qemu: could not add USB device 'tablet'

He's correct in that params is never NULL (if it was NULL it's set to an empty string some lines earlier, introduced by 702f3e0f), so usb_create_simple is never called. Maybe the right fix is to check for *params instead of params now?

Yes, you are right. I did a new patch for it.