diff options
author | Thomas Haller <thaller@redhat.com> | 2019-08-01 14:56:07 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-08-01 14:56:07 +0200 |
commit | 72e604c8e4a0d89c9474a7048d330a9bc8406812 (patch) | |
tree | 642c5a859bbf98fd0a08c3f39e23016827e5a2d3 | |
parent | 5f668b81d34f35d4d75546a02cb8d6755dfa87fb (diff) | |
download | NetworkManager-72e604c8e4a0d89c9474a7048d330a9bc8406812.tar.gz |
device: avoid unnecessary check for existing device in release_slave() implementations
-rw-r--r-- | src/devices/nm-device-bond.c | 10 | ||||
-rw-r--r-- | src/devices/nm-device-bridge.c | 10 | ||||
-rw-r--r-- | src/devices/team/nm-device-team.c | 10 |
3 files changed, 18 insertions, 12 deletions
diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c index 50494526a9..7626b04a00 100644 --- a/src/devices/nm-device-bond.c +++ b/src/devices/nm-device-bond.c @@ -416,10 +416,12 @@ release_slave (NMDevice *device, int ifindex_slave; int ifindex; - ifindex = nm_device_get_ifindex (device); - if ( ifindex <= 0 - || !nm_platform_link_get (nm_device_get_platform (device), ifindex)) - configure = FALSE; + if (configure) { + ifindex = nm_device_get_ifindex (device); + if ( ifindex <= 0 + || !nm_platform_link_get (nm_device_get_platform (device), ifindex)) + configure = FALSE; + } ifindex_slave = nm_device_get_ip_ifindex (slave); diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c index 91d824b35b..8f3a4045ba 100644 --- a/src/devices/nm-device-bridge.c +++ b/src/devices/nm-device-bridge.c @@ -628,10 +628,12 @@ release_slave (NMDevice *device, int ifindex_slave; int ifindex; - ifindex = nm_device_get_ifindex (device); - if ( ifindex <= 0 - || !nm_platform_link_get (nm_device_get_platform (device), ifindex)) - configure = FALSE; + if (configure) { + ifindex = nm_device_get_ifindex (device); + if ( ifindex <= 0 + || !nm_platform_link_get (nm_device_get_platform (device), ifindex)) + configure = FALSE; + } ifindex_slave = nm_device_get_ip_ifindex (slave); diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c index 4661a84034..79ac8935bb 100644 --- a/src/devices/team/nm-device-team.c +++ b/src/devices/team/nm-device-team.c @@ -777,10 +777,12 @@ release_slave (NMDevice *device, int ifindex_slave; int ifindex; - ifindex = nm_device_get_ifindex (device); - if ( ifindex <= 0 - || !nm_platform_link_get (nm_device_get_platform (device), ifindex)) - configure = FALSE; + if (configure) { + ifindex = nm_device_get_ifindex (device); + if ( ifindex <= 0 + || !nm_platform_link_get (nm_device_get_platform (device), ifindex)) + configure = FALSE; + } ifindex_slave = nm_device_get_ip_ifindex (slave); |