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