5c27b6
From 2e92e9904792f9f69d3d6c51a47eb1238064ee12 Mon Sep 17 00:00:00 2001
5c27b6
Message-Id: <2e92e9904792f9f69d3d6c51a47eb1238064ee12@dist-git>
5c27b6
From: Laine Stump <laine@laine.org>
5c27b6
Date: Thu, 13 Apr 2017 14:29:22 -0400
5c27b6
Subject: [PATCH] util: eliminate useless local variable
5c27b6
5c27b6
vf in virNetDevMacVLanDeleteWithVPortProfile() is initialized to -1
5c27b6
and never set. It's not set for a good reason - because it doesn't
5c27b6
make sense during macvtap device setup to refer to a VF device as
5c27b6
"PF:VF#". This patch replaces the two uses of "vf" with "-1", and
5c27b6
removes the local variable, so that it's more clear we are always
5c27b6
calling the utility functions with vf set to -1.
5c27b6
5c27b6
Resolves: https://bugzilla.redhat.com/1442040 (RHEL 7.3.z)
5c27b6
Resolves: https://bugzilla.redhat.com/1415609 (RHEL 7.4)
5c27b6
5c27b6
(cherry picked from commit 606a01339563b5371f21a9b2c10ef818c0557fb1)
5c27b6
---
5c27b6
 src/util/virnetdevmacvlan.c | 7 +++----
5c27b6
 1 file changed, 3 insertions(+), 4 deletions(-)
5c27b6
5c27b6
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
5c27b6
index 88a0f9485..61da55415 100644
5c27b6
--- a/src/util/virnetdevmacvlan.c
5c27b6
+++ b/src/util/virnetdevmacvlan.c
5c27b6
@@ -1,5 +1,5 @@
5c27b6
 /*
5c27b6
- * Copyright (C) 2010-2016 Red Hat, Inc.
5c27b6
+ * Copyright (C) 2010-2017 Red Hat, Inc.
5c27b6
  * Copyright (C) 2010-2012 IBM Corporation
5c27b6
  *
5c27b6
  * This library is free software; you can redistribute it and/or
5c27b6
@@ -1190,14 +1190,13 @@ int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname,
5c27b6
                                            char *stateDir)
5c27b6
 {
5c27b6
     int ret = 0;
5c27b6
-    int vf = -1;
5c27b6
 
5c27b6
     if (ifname) {
5c27b6
         if (virNetDevVPortProfileDisassociate(ifname,
5c27b6
                                               virtPortProfile,
5c27b6
                                               macaddr,
5c27b6
                                               linkdev,
5c27b6
-                                              vf,
5c27b6
+                                              -1,
5c27b6
                                               VIR_NETDEV_VPORT_PROFILE_OP_DESTROY) < 0)
5c27b6
             ret = -1;
5c27b6
         if (virNetDevMacVLanDelete(ifname) < 0)
5c27b6
@@ -1210,7 +1209,7 @@ int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname,
5c27b6
              virtPortProfile->virtPortType == VIR_NETDEV_VPORT_PROFILE_8021QBH)
5c27b6
             ignore_value(virNetDevRestoreMacAddress(linkdev, stateDir));
5c27b6
         else
5c27b6
-            ignore_value(virNetDevRestoreNetConfig(linkdev, vf, stateDir));
5c27b6
+            ignore_value(virNetDevRestoreNetConfig(linkdev, -1, stateDir));
5c27b6
     }
5c27b6
 
5c27b6
     virNetlinkEventRemoveClient(0, macaddr, NETLINK_ROUTE);
5c27b6
-- 
5c27b6
2.12.2
5c27b6