diff options
author | Markus Armbruster <armbru@redhat.com> | 2009-10-07 01:15:57 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-10-07 08:54:54 -0500 |
commit | 33e66b86d89040f0a9e99aa53deb74ce8936a649 (patch) | |
tree | a356cfe20774dbc9e6107d8824414c1ea75599ce /usb-linux.c | |
parent | 18cfeb52d17825dddadfc74e99255530aa889136 (diff) | |
download | hqemu-33e66b86d89040f0a9e99aa53deb74ce8936a649.zip hqemu-33e66b86d89040f0a9e99aa53deb74ce8936a649.tar.gz |
Check return value of qdev_init()
But do so only where it may actually fail. Leave the rest for the
next commit.
Patchworks-ID: 35167
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'usb-linux.c')
-rw-r--r-- | usb-linux.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usb-linux.c b/usb-linux.c index 77cbf1b..9e5d9c4 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -980,12 +980,14 @@ static USBDevice *usb_host_device_open_addr(int bus_num, int addr, const char *p hostdev_link(dev); - qdev_init(&d->qdev); + if (qdev_init(&d->qdev) < 0) + goto fail_no_qdev; return (USBDevice *) dev; fail: if (d) qdev_free(&d->qdev); +fail_no_qdev: if (fd != -1) close(fd); return NULL; @@ -1389,7 +1391,7 @@ static int usb_host_auto_scan(void *opaque, int bus_num, int addr, /* We got a match */ - /* Allredy attached ? */ + /* Already attached ? */ if (hostdev_find(bus_num, addr)) return 0; |