qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [6987] pci_add storage: fix error handling for 'if' paramet


From: Anthony Liguori
Subject: [Qemu-devel] [6987] pci_add storage: fix error handling for 'if' parameter ( Eduardo Habkost)
Date: Sun, 05 Apr 2009 18:16:05 +0000

Revision: 6987
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6987
Author:   aliguori
Date:     2009-04-05 18:16:04 +0000 (Sun, 05 Apr 2009)
Log Message:
-----------
pci_add storage: fix error handling for 'if' parameter (Eduardo Habkost)

This fixes:

 - The error message to show the actual if= argument value. It was showing
   the filename instead, because 'buf' is reaused on the filename parsing.
 - A bug that makes a block device to be created even when an unsupported if= 
arg
   is passed to pci_add.

Signed-off-by: Eduardo Habkost <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>

Modified Paths:
--------------
    branches/stable_0_10/hw/pci-hotplug.c

Modified: branches/stable_0_10/hw/pci-hotplug.c
===================================================================
--- branches/stable_0_10/hw/pci-hotplug.c       2009-04-05 18:15:59 UTC (rev 
6986)
+++ branches/stable_0_10/hw/pci-hotplug.c       2009-04-05 18:16:04 UTC (rev 
6987)
@@ -95,19 +95,22 @@
             type = IF_SCSI;
         else if (!strcmp(buf, "virtio")) {
             type = IF_VIRTIO;
+        } else {
+            term_printf("type %s not a hotpluggable PCI device.\n", buf);
+            goto out;
         }
     } else {
         term_printf("no if= specified\n");
-        return NULL;
+        goto out;
     }
 
     if (get_param_value(buf, sizeof(buf), "file", opts)) {
         drive_idx = add_init_drive(opts);
         if (drive_idx < 0)
-            return NULL;
+            goto out;
     } else if (type == IF_VIRTIO) {
         term_printf("virtio requires a backing file/device.\n");
-        return NULL;
+        goto out;
     }
 
     switch (type) {
@@ -120,10 +123,9 @@
     case IF_VIRTIO:
         opaque = virtio_blk_init (pci_bus, drives_table[drive_idx].bdrv);
         break;
-    default:
-        term_printf ("type %s not a hotpluggable PCI device.\n", buf);
     }
 
+out:
     return opaque;
 }
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]