device: avoid unnecessary check for existing device in release_slave() implementations

This commit is contained in:
Thomas Haller 2019-08-01 14:56:07 +02:00
parent 5f668b81d3
commit 72e604c8e4
3 changed files with 18 additions and 12 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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);