404507
From f2dd85b3b81cd5c0842ffb55554c1a9cb5e8764b Mon Sep 17 00:00:00 2001
404507
Message-Id: <f2dd85b3b81cd5c0842ffb55554c1a9cb5e8764b@dist-git>
404507
From: Andrea Bolognani <abologna@redhat.com>
404507
Date: Wed, 29 Nov 2017 16:23:01 +0100
404507
Subject: [PATCH] conf: Improve error handling in virDomainChrDefFormat()
404507
404507
We don't need to store the return value since we never modify it.
404507
404507
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
404507
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
404507
(cherry picked from commit be956c4e38770dd61998815bbea4b7c2fc38a7d6)
404507
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1449265
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1511421
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1512929
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1512934
404507
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
404507
---
404507
 src/conf/domain_conf.c | 6 ++----
404507
 1 file changed, 2 insertions(+), 4 deletions(-)
404507
404507
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
404507
index d68a5f415c..cf1bd030a0 100644
404507
--- a/src/conf/domain_conf.c
404507
+++ b/src/conf/domain_conf.c
404507
@@ -24028,8 +24028,6 @@ virDomainChrDefFormat(virBufferPtr buf,
404507
     const char *elementName = virDomainChrDeviceTypeToString(def->deviceType);
404507
     bool tty_compat;
404507
 
404507
-    int ret = 0;
404507
-
404507
     if (!elementName) {
404507
         virReportError(VIR_ERR_INTERNAL_ERROR,
404507
                        _("unexpected char device type %d"),
404507
@@ -24050,14 +24048,14 @@ virDomainChrDefFormat(virBufferPtr buf,
404507
     virDomainChrSourceDefFormat(buf, def->source, flags);
404507
 
404507
     if (virDomainChrTargetDefFormat(buf, def, flags) < 0)
404507
-       return -1;
404507
+        return -1;
404507
 
404507
     virDomainDeviceInfoFormat(buf, &def->info, flags);
404507
 
404507
     virBufferAdjustIndent(buf, -2);
404507
     virBufferAsprintf(buf, "</%s>\n", elementName);
404507
 
404507
-    return ret;
404507
+    return 0;
404507
 }
404507
 
404507
 static int
404507
-- 
404507
2.15.1
404507