diff options
author | 2009-12-15 11:43:02 +0100 | |
---|---|---|
committer | 2009-12-19 08:26:22 -0600 | |
commit | 53425683d41624d73424338758e28c4794ef3b03 (patch) | |
tree | 4b89c6e027c1cb4d5066746c13583234e717179e /usb-linux.c | |
parent | usb-net: use qdev for -usbdevice (diff) | |
download | qemu-kvm-53425683d41624d73424338758e28c4794ef3b03.tar.gz qemu-kvm-53425683d41624d73424338758e28c4794ef3b03.tar.bz2 qemu-kvm-53425683d41624d73424338758e28c4794ef3b03.zip |
usb-host: check mon before using it.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit eba6fe8732cb5109b6fcf6a973d8959827eb7af4)
Diffstat (limited to 'usb-linux.c')
-rw-r--r-- | usb-linux.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usb-linux.c b/usb-linux.c index 105ce88f3..88728e927 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -1206,7 +1206,8 @@ static int usb_host_read_file(char *line, size_t line_size, const char *device_f ret = 1; #if 0 } else { - monitor_printf(mon, "husb: could not open %s\n", filename); + if (mon) + monitor_printf(mon, "husb: could not open %s\n", filename); #endif } @@ -1339,15 +1340,17 @@ static int usb_host_scan(void *opaque, USBScanFunc *func) } found_devices: if (!usb_fs_type) { - monitor_printf(mon, "husb: unable to access USB devices\n"); + if (mon) + monitor_printf(mon, "husb: unable to access USB devices\n"); return -ENOENT; } /* the module setting (used later for opening devices) */ usb_host_device_path = qemu_mallocz(strlen(devpath)+1); strcpy(usb_host_device_path, devpath); - monitor_printf(mon, "husb: using %s file-system with %s\n", - fs_type[usb_fs_type], usb_host_device_path); + if (mon) + monitor_printf(mon, "husb: using %s file-system with %s\n", + fs_type[usb_fs_type], usb_host_device_path); } switch (usb_fs_type) { |