From 9da9f22fed43388394aaa967e9150f6fc56b442c Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 5 Feb 2018 15:01:48 +0100 Subject: [PATCH] manager: reorder conditions in unmanaged_to_disconnected() to check cheaper condition first Getting nm_device_get_state() is cheap, contrary to nm_device_is_available(). Reorder the checks. (cherry picked from commit 6075348f0f2b95fcaafd0b5f4ee6c075a8e66a81) --- src/nm-manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nm-manager.c b/src/nm-manager.c index f9b595c940..cd575a522a 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -3563,8 +3563,8 @@ unmanaged_to_disconnected (NMDevice *device) NM_DEVICE_STATE_REASON_USER_REQUESTED); } - if ( nm_device_is_available (device, NM_DEVICE_CHECK_DEV_AVAILABLE_FOR_USER_REQUEST) - && (nm_device_get_state (device) == NM_DEVICE_STATE_UNAVAILABLE)) { + if ( nm_device_get_state (device) == NM_DEVICE_STATE_UNAVAILABLE + && nm_device_is_available (device, NM_DEVICE_CHECK_DEV_AVAILABLE_FOR_USER_REQUEST)) { nm_device_state_changed (device, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_USER_REQUESTED);