]> git.proxmox.com Git - qemu.git/commitdiff
usb-host: check mon before using it.
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 15 Dec 2009 10:43:02 +0000 (11:43 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 18 Dec 2009 17:26:28 +0000 (11:26 -0600)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
usb-linux.c

index 105ce88f3cce8b2396e4e0ae7a8a586bee64293c..88728e927e3b32803d66464c872d5dd6813790ca 100644 (file)
@@ -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) {