usb-host: check mon before using it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Gerd Hoffmann 2009-12-15 11:43:02 +01:00 committed by Anthony Liguori
parent 42be86ce95
commit eba6fe8732

View File

@ -1206,6 +1206,7 @@ static int usb_host_read_file(char *line, size_t line_size, const char *device_f
ret = 1; ret = 1;
#if 0 #if 0
} else { } else {
if (mon)
monitor_printf(mon, "husb: could not open %s\n", filename); monitor_printf(mon, "husb: could not open %s\n", filename);
#endif #endif
} }
@ -1339,6 +1340,7 @@ static int usb_host_scan(void *opaque, USBScanFunc *func)
} }
found_devices: found_devices:
if (!usb_fs_type) { if (!usb_fs_type) {
if (mon)
monitor_printf(mon, "husb: unable to access USB devices\n"); monitor_printf(mon, "husb: unable to access USB devices\n");
return -ENOENT; return -ENOENT;
} }
@ -1346,6 +1348,7 @@ static int usb_host_scan(void *opaque, USBScanFunc *func)
/* the module setting (used later for opening devices) */ /* the module setting (used later for opening devices) */
usb_host_device_path = qemu_mallocz(strlen(devpath)+1); usb_host_device_path = qemu_mallocz(strlen(devpath)+1);
strcpy(usb_host_device_path, devpath); strcpy(usb_host_device_path, devpath);
if (mon)
monitor_printf(mon, "husb: using %s file-system with %s\n", monitor_printf(mon, "husb: using %s file-system with %s\n",
fs_type[usb_fs_type], usb_host_device_path); fs_type[usb_fs_type], usb_host_device_path);
} }