qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: peter.maydell@linaro.org
Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws
Subject: [Qemu-devel] [PULL 21/38] pci-assign: assigned_initfn(): set monitor error in common error handler
Date: Thu,  8 May 2014 14:52:45 -0400	[thread overview]
Message-ID: <1399575182-9768-22-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1399575182-9768-1-git-send-email-lcapitulino@redhat.com>

From: Laszlo Ersek <lersek@redhat.com>

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 hw/i386/kvm/pci-assign.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index 6891729..e55421a 100644
--- a/hw/i386/kvm/pci-assign.c
+++ b/hw/i386/kvm/pci-assign.c
@@ -1756,14 +1756,14 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
     Error *local_err = NULL;
 
     if (!kvm_enabled()) {
-        error_report("pci-assign: error: requires KVM support");
-        return -1;
+        error_setg(&local_err, "pci-assign requires KVM support");
+        goto exit_with_error;
     }
 
     if (!dev->host.domain && !dev->host.bus && !dev->host.slot &&
         !dev->host.function) {
-        error_report("pci-assign: error: no host device specified");
-        return -1;
+        error_setg(&local_err, "no host device specified");
+        goto exit_with_error;
     }
 
     /*
@@ -1788,14 +1788,10 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
 
     get_real_device(dev, &local_err);
     if (local_err) {
-        qerror_report_err(local_err);
-        error_free(local_err);
         goto out;
     }
 
     if (assigned_device_pci_cap_init(pci_dev, &local_err) < 0) {
-        qerror_report_err(local_err);
-        error_free(local_err);
         goto out;
     }
 
@@ -1803,8 +1799,6 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
     if (dev->cap.available & ASSIGNED_DEVICE_CAP_MSIX) {
         assigned_dev_register_msix_mmio(dev, &local_err);
         if (local_err) {
-            qerror_report_err(local_err);
-            error_free(local_err);
             goto out;
         }
     }
@@ -1814,8 +1808,6 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
                                   dev->real_device.region_number, dev,
                                   &local_err);
     if (local_err) {
-        qerror_report_err(local_err);
-        error_free(local_err);
         goto out;
     }
 
@@ -1828,16 +1820,12 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
     /* assign device to guest */
     assign_device(dev, &local_err);
     if (local_err) {
-        qerror_report_err(local_err);
-        error_free(local_err);
         goto out;
     }
 
     /* assign legacy INTx to the device */
     r = assign_intx(dev, &local_err);
     if (r < 0) {
-        qerror_report_err(local_err);
-        error_free(local_err);
         goto assigned_out;
     }
 
@@ -1849,8 +1837,14 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
 
 assigned_out:
     deassign_device(dev);
+
 out:
     free_assigned_device(dev);
+
+exit_with_error:
+    assert(local_err);
+    qerror_report_err(local_err);
+    error_free(local_err);
     return -1;
 }
 
-- 
1.9.0

  parent reply	other threads:[~2014-05-08 18:53 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-08 18:52 [Qemu-devel] [PULL 00/38] QMP queue Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 01/38] qapi: [trivial] Break long command lines Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 02/38] qapi: [trivial] Do not catch unknown exceptions in "test-qapi.py" Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 03/38] qapi: Use an explicit input file Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 04/38] qapi: Add a primitive to include other files from a QAPI schema file Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 05/38] qapi: treat all negative return of strtosz_suffix() as error Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 06/38] cutils: tighten qemu_parse_fd() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 07/38] monitor: add Error-propagating monitor_handle_fd_param2() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 08/38] pci-assign: accept Error from monitor_handle_fd_param2() Luiz Capitulino
2014-05-09 22:48   ` Eric Blake
2014-05-12 12:58     ` Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 09/38] pci-assign: make assign_failed_examine() just format the cause Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 10/38] pci-assign: propagate errors from get_real_id() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 11/38] pci-assign: propagate Error from check_irqchip_in_kernel() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 12/38] pci: add Error-propagating pci_add_capability2() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 13/38] pci-assign: accept Error from pci_add_capability2() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 14/38] pci-assign: assignment should fail if we can't read config space Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 15/38] pci-assign: propagate errors from get_real_device() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 16/38] pci-assign: propagate errors from assigned_device_pci_cap_init() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 17/38] pci-assign: propagate errors from assigned_dev_register_msix_mmio() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 18/38] pci-assign: propagate errors from assigned_dev_register_regions() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 19/38] pci-assign: propagate errors from assign_device() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 20/38] pci-assign: propagate errors from assign_intx() Luiz Capitulino
2014-05-08 18:52 ` Luiz Capitulino [this message]
2014-05-08 18:52 ` [Qemu-devel] [PULL 22/38] qmp hmp: Consistently name Error * objects err, and not errp Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 23/38] qga: Consistently name Error ** objects errp, and not err Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 24/38] qmp: " Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 25/38] error: " Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 26/38] qga: Use return values instead of error_is_set(errp) Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 27/38] hmp: Guard against misuse of hmp_handle_error() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 28/38] qapi: Drop redundant, unclean error_is_set() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 29/38] tests/qapi-schema: Drop superfluous error_is_set() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 30/38] qapi: Clean up fragile use of error_is_set() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 31/38] qga: " Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 32/38] qga: Drop superfluous error_is_set() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 33/38] qemu-option: Clean up fragile use of error_is_set() Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 34/38] dump: Drop pointless error_is_set(), DumpState member errp Luiz Capitulino
2014-05-08 18:52 ` [Qemu-devel] [PULL 35/38] qmp: Don't use error_is_set() to suppress additional errors Luiz Capitulino
2014-05-08 18:53 ` [Qemu-devel] [PULL 36/38] qmp: use valid JSON in transaction example Luiz Capitulino
2014-05-08 18:53 ` [Qemu-devel] [PULL 37/38] qapi: Document optional arguments' backwards compatibility Luiz Capitulino
2014-05-08 18:53 ` [Qemu-devel] [PULL 38/38] Revert "qapi: Clean up superfluous null check in qapi_dealloc_type_str()" Luiz Capitulino
2014-05-09 11:57 ` [Qemu-devel] [PULL 00/38] QMP queue Peter Maydell
2014-05-09 12:54   ` Markus Armbruster
2014-05-09 12:58     ` Luiz Capitulino
2014-05-09 13:50   ` Luiz Capitulino
2014-05-09 15:47     ` Peter Maydell

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=1399575182-9768-22-git-send-email-lcapitulino@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=peter.maydell@linaro.org \
    --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).