summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-04-12 14:16:25 +0200
committerThomas Haller <thaller@redhat.com>2018-04-12 14:17:05 +0200
commit251e5707d58d3aacfab971759176ef8d78105548 (patch)
tree1ba07711f93aac630ef314a1ee1251b2b9636a0b
parentd5ee549e07b8f4c34b5d9c07d8048dbb9e8bd0ef (diff)
device: return early from handle_auth_or_fail() on failure
Don't do if-else, if one branch is going to return with failure.
-rw-r--r--src/devices/nm-device-ethernet.c9
-rw-r--r--src/devices/nm-device-macsec.c9
2 files changed, 8 insertions, 10 deletions
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c
index f0b411e344..56dc7f43ce 100644
--- a/src/devices/nm-device-ethernet.c
+++ b/src/devices/nm-device-ethernet.c
@@ -667,15 +667,14 @@ handle_auth_or_fail (NMDeviceEthernet *self,
applied_connection = nm_act_request_get_applied_connection (req);
setting_name = nm_connection_need_secrets (applied_connection, NULL);
- if (setting_name) {
- wired_secrets_get_secrets (self, setting_name,
- NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION
- | (new_secrets ? NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW : 0));
- } else {
+ if (!setting_name) {
_LOGI (LOGD_DEVICE, "Cleared secrets, but setting didn't need any secrets.");
return NM_ACT_STAGE_RETURN_FAILURE;
}
+ wired_secrets_get_secrets (self, setting_name,
+ NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION
+ | (new_secrets ? NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW : 0));
return NM_ACT_STAGE_RETURN_POSTPONE;
}
diff --git a/src/devices/nm-device-macsec.c b/src/devices/nm-device-macsec.c
index a6759b3938..895ea34f64 100644
--- a/src/devices/nm-device-macsec.c
+++ b/src/devices/nm-device-macsec.c
@@ -490,15 +490,14 @@ handle_auth_or_fail (NMDeviceMacsec *self,
applied_connection = nm_act_request_get_applied_connection (req);
setting_name = nm_connection_need_secrets (applied_connection, NULL);
- if (setting_name) {
- macsec_secrets_get_secrets (self, setting_name,
- NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION
- | (new_secrets ? NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW : 0));
- } else {
+ if (!setting_name) {
_LOGI (LOGD_DEVICE, "Cleared secrets, but setting didn't need any secrets.");
return NM_ACT_STAGE_RETURN_FAILURE;
}
+ macsec_secrets_get_secrets (self, setting_name,
+ NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION
+ | (new_secrets ? NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW : 0));
return NM_ACT_STAGE_RETURN_POSTPONE;
}