Re: [PATCH v3 08/10] conf: Clean up some unnecessary goto paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 01, 2019 at 11:26:50AM -0500, John Ferlan wrote:
Now that we're using VIR_AUTOFREE there's quite a bit of clean up
possible for now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
src/conf/domain_conf.c | 801 ++++++++++++++++-------------------------
1 file changed, 310 insertions(+), 491 deletions(-)


@@ -7692,7 +7659,6 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr sourcenode,
                                      virDomainHostdevSubsysSCSIPtr scsisrc,
                                      xmlXPathContextPtr ctxt)
{
-    int ret = -1;
    VIR_AUTOFREE(char *) protocol = NULL;

    if ((protocol = virXMLPropString(sourcenode, "protocol"))) {
@@ -7702,17 +7668,14 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr sourcenode,
            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                           _("Unknown SCSI subsystem protocol '%s'"),
                           protocol);
-            goto cleanup;
+            return -1;
        }
    }

    if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
-        ret = virDomainHostdevSubsysSCSIiSCSIDefParseXML(sourcenode, scsisrc, ctxt);
-    else
-        ret = virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, scsisrc);
+        return virDomainHostdevSubsysSCSIiSCSIDefParseXML(sourcenode, scsisrc, ctxt);

- cleanup:
-    return ret;
+    return virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, scsisrc);

This looks odd. But having the else branch would look even more so.

}

static int

Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux