qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: amit.shah@redhat.com, jsnow@redhat.com, armbru@redhat.com,
	stefanha@redhat.com, lcapitulino@redhat.com
Subject: [Qemu-devel] [PATCH 2/2] virtio-rng: replace error_set calls with error_setg
Date: Tue, 29 Jul 2014 19:28:58 -0400	[thread overview]
Message-ID: <1406676538-23149-3-git-send-email-jsnow@redhat.com> (raw)
In-Reply-To: <1406676538-23149-1-git-send-email-jsnow@redhat.com>

Under recommendation from Luiz Capitulino, we are changing
the error_set calls to error_setg while we are fixing up
the error handling pathways of virtio-rng.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 hw/virtio/virtio-rng.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
index ff58917..03fd04a 100644
--- a/hw/virtio/virtio-rng.c
+++ b/hw/virtio/virtio-rng.c
@@ -142,16 +142,15 @@ static void virtio_rng_device_realize(DeviceState *dev, Error **errp)
     Error *local_err = NULL;
 
     if (!vrng->conf.period_ms > 0) {
-        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "period",
-                  "a positive number");
+        error_setg(errp, "'period' parameter expects a positive integer");
         return;
     }
 
     /* Workaround: Property parsing does not enforce unsigned integers,
      * So this is a hack to reject such numbers. */
     if (vrng->conf.max_bytes > INT64_MAX) {
-        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "max-bytes",
-                  "a non-negative integer below 2^63");
+        error_setg(errp, "'max-bytes' parameter must be non-negative, "
+                   "and less than 2^63");
         return;
     }
 
@@ -181,7 +180,7 @@ static void virtio_rng_device_realize(DeviceState *dev, Error **errp)
 
     vrng->rng = vrng->conf.rng;
     if (vrng->rng == NULL) {
-        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "rng", "a valid object");
+        error_setg(errp, "'rng' parameter expects a valid object");
         return;
     }
 
-- 
1.9.3

  parent reply	other threads:[~2014-07-29 23:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-29 23:28 [Qemu-devel] [PATCH 0/2] virtio-rng: Fix memory leaks in virtio_rng_device_realize John Snow
2014-07-29 23:28 ` [Qemu-devel] [PATCH 1/2] virtio-rng: Move error-checking forward to prevent memory leak John Snow
2014-07-29 23:28 ` John Snow [this message]
2014-07-30  5:57 ` [Qemu-devel] [PATCH 0/2] virtio-rng: Fix memory leaks in virtio_rng_device_realize Markus Armbruster
2014-07-30 15:26 ` Stefan Hajnoczi
2014-08-01  5:09 ` Amit Shah

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=1406676538-23149-3-git-send-email-jsnow@redhat.com \
    --to=jsnow@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).