qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [6981] pci_add storage: fix error handling for 'if' parameter ( Eduardo Habkost)
Date: Sun, 05 Apr 2009 17:40:55 +0000	[thread overview]
Message-ID: <E1LqWL1-0006Ar-Cj@cvs.savannah.gnu.org> (raw)

Revision: 6981
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6981
Author:   aliguori
Date:     2009-04-05 17:40:55 +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 <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Modified Paths:
--------------
    trunk/hw/pci-hotplug.c

Modified: trunk/hw/pci-hotplug.c
===================================================================
--- trunk/hw/pci-hotplug.c	2009-04-05 17:40:50 UTC (rev 6980)
+++ trunk/hw/pci-hotplug.c	2009-04-05 17:40:55 UTC (rev 6981)
@@ -97,19 +97,22 @@
             type = IF_SCSI;
         else if (!strcmp(buf, "virtio")) {
             type = IF_VIRTIO;
+        } else {
+            monitor_printf(mon, "type %s not a hotpluggable PCI device.\n", buf);
+            goto out;
         }
     } else {
         monitor_printf(mon, "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) {
         monitor_printf(mon, "virtio requires a backing file/device.\n");
-        return NULL;
+        goto out;
     }
 
     switch (type) {
@@ -122,10 +125,9 @@
     case IF_VIRTIO:
         opaque = virtio_blk_init (pci_bus, drives_table[drive_idx].bdrv);
         break;
-    default:
-        monitor_printf(mon, "type %s not a hotpluggable PCI device.\n", buf);
     }
 
+out:
     return opaque;
 }
 

                 reply	other threads:[~2009-04-05 17:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1LqWL1-0006Ar-Cj@cvs.savannah.gnu.org \
    --to=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).