summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-08-22 07:41:34 +0200
committerThomas Haller <thaller@redhat.com>2019-08-28 16:27:00 +0200
commit7fd50f2789c35f2a13d0783deb1d7bb9fd6e079e (patch)
treeed21bcc52a93f542084898920f9bf25750542ea3 /src
parent7bf8c45b192547f83adddde83ffcbac9e90fe0b8 (diff)
downloadNetworkManager-7fd50f2789c35f2a13d0783deb1d7bb9fd6e079e.tar.gz
device: various minor style cleanup
Diffstat (limited to 'src')
-rw-r--r--src/devices/nm-device-infiniband.c2
-rw-r--r--src/devices/nm-device-tun.c12
-rw-r--r--src/devices/nm-device-vlan.c5
-rw-r--r--src/devices/team/nm-device-team.c9
-rw-r--r--src/devices/wifi/nm-device-iwd.c21
-rw-r--r--src/devices/wwan/nm-device-modem.c4
6 files changed, 31 insertions, 22 deletions
diff --git a/src/devices/nm-device-infiniband.c b/src/devices/nm-device-infiniband.c
index 89db2af294..18b4d64a3f 100644
--- a/src/devices/nm-device-infiniband.c
+++ b/src/devices/nm-device-infiniband.c
@@ -94,7 +94,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
dirfd = nm_platform_sysctl_open_netdir (nm_device_get_platform (device), nm_device_get_ifindex (device), ifname_verified);
if (dirfd < 0) {
- if (!strcmp (transport_mode, "datagram"))
+ if (nm_streq (transport_mode, "datagram"))
return NM_ACT_STAGE_RETURN_SUCCESS;
else {
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_INFINIBAND_MODE);
diff --git a/src/devices/nm-device-tun.c b/src/devices/nm-device-tun.c
index afe83f506a..50099248b9 100644
--- a/src/devices/nm-device-tun.c
+++ b/src/devices/nm-device-tun.c
@@ -357,12 +357,12 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
return ret;
- /* Nothing to do for TUN devices */
- if (priv->props.type == IFF_TUN)
- return NM_ACT_STAGE_RETURN_SUCCESS;
-
- if (!nm_device_hw_addr_set_cloned (device, nm_device_get_applied_connection (device), FALSE))
- return NM_ACT_STAGE_RETURN_FAILURE;
+ if (priv->props.type == IFF_TUN) {
+ /* Nothing to do for TUN devices */
+ } else {
+ if (!nm_device_hw_addr_set_cloned (device, nm_device_get_applied_connection (device), FALSE))
+ return NM_ACT_STAGE_RETURN_FAILURE;
+ }
return NM_ACT_STAGE_RETURN_SUCCESS;
}
diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c
index 0467a6e450..27611499c9 100644
--- a/src/devices/nm-device-vlan.c
+++ b/src/devices/nm-device-vlan.c
@@ -497,7 +497,8 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
if (s_vlan) {
gs_free NMVlanQosMapping *ingress_map = NULL;
gs_free NMVlanQosMapping *egress_map = NULL;
- guint n_ingress_map = 0, n_egress_map = 0;
+ guint n_ingress_map = 0;
+ guint n_egress_map = 0;
_nm_setting_vlan_get_priorities (s_vlan,
NM_VLAN_INGRESS_MAP,
@@ -520,7 +521,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
n_egress_map);
}
- return ret;
+ return NM_ACT_STAGE_RETURN_SUCCESS;
}
static guint32
diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c
index 10982cfa4f..fb176ed13e 100644
--- a/src/devices/team/nm-device-team.c
+++ b/src/devices/team/nm-device-team.c
@@ -660,7 +660,8 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
* have a PID, then we must fail.
*/
cfg = teamdctl_config_get_raw (priv->tdc);
- if (cfg && nm_streq0 (cfg, nm_setting_team_get_config (s_team))) {
+ if ( cfg
+ && nm_streq0 (cfg, nm_setting_team_get_config (s_team))) {
_LOGD (LOGD_TEAM, "using existing matching teamd config");
return NM_ACT_STAGE_RETURN_SUCCESS;
}
@@ -684,8 +685,10 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
return NM_ACT_STAGE_RETURN_POSTPONE;
}
- return teamd_start (device, connection) ?
- NM_ACT_STAGE_RETURN_POSTPONE : NM_ACT_STAGE_RETURN_FAILURE;
+ if (!teamd_start (device, connection))
+ return NM_ACT_STAGE_RETURN_FAILURE;
+
+ return NM_ACT_STAGE_RETURN_POSTPONE;
}
static void
diff --git a/src/devices/wifi/nm-device-iwd.c b/src/devices/wifi/nm-device-iwd.c
index 9cfe5f70a1..b97f439125 100644
--- a/src/devices/wifi/nm-device-iwd.c
+++ b/src/devices/wifi/nm-device-iwd.c
@@ -1716,6 +1716,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
NMDeviceIwdPrivate *priv = NM_DEVICE_IWD_GET_PRIVATE (self);
NMActStageReturn ret;
NMWifiAP *ap = NULL;
+ gs_unref_object NMWifiAP *ap_fake = NULL;
NMActRequest *req;
NMConnection *connection;
NMSettingWireless *s_wireless;
@@ -1741,7 +1742,9 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
goto add_new;
ap_path = nm_active_connection_get_specific_object (NM_ACTIVE_CONNECTION (req));
- ap = ap_path ? nm_wifi_ap_lookup_for_device (NM_DEVICE (self), ap_path) : NULL;
+ ap = ap_path
+ ? nm_wifi_ap_lookup_for_device (NM_DEVICE (self), ap_path)
+ : NULL;
if (ap) {
set_current_ap (self, ap, TRUE);
return NM_ACT_STAGE_RETURN_SUCCESS;
@@ -1767,19 +1770,19 @@ add_new:
* until the real one is found in the scan list (Ad-Hoc or Hidden), or until
* the device is deactivated (Ad-Hoc or Hotspot).
*/
- ap = nm_wifi_ap_new_fake_from_connection (connection);
- g_return_val_if_fail (ap != NULL, NM_ACT_STAGE_RETURN_FAILURE);
+ ap_fake = nm_wifi_ap_new_fake_from_connection (connection);
+ if (!ap_fake)
+ g_return_val_if_reached (NM_ACT_STAGE_RETURN_FAILURE);
- if (nm_wifi_ap_is_hotspot (ap))
- nm_wifi_ap_set_address (ap, nm_device_get_hw_address (device));
+ if (nm_wifi_ap_is_hotspot (ap_fake))
+ nm_wifi_ap_set_address (ap_fake, nm_device_get_hw_address (device));
g_object_freeze_notify (G_OBJECT (self));
- ap_add_remove (self, TRUE, ap, FALSE);
+ ap_add_remove (self, TRUE, ap_fake, FALSE);
g_object_thaw_notify (G_OBJECT (self));
- set_current_ap (self, ap, FALSE);
+ set_current_ap (self, ap_fake, FALSE);
nm_active_connection_set_specific_object (NM_ACTIVE_CONNECTION (req),
- nm_dbus_object_get_path (NM_DBUS_OBJECT (ap)));
- g_object_unref (ap);
+ nm_dbus_object_get_path (NM_DBUS_OBJECT (ap_fake)));
return NM_ACT_STAGE_RETURN_SUCCESS;
}
diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c
index fc38fec435..29c51162d0 100644
--- a/src/devices/wwan/nm-device-modem.c
+++ b/src/devices/wwan/nm-device-modem.c
@@ -593,7 +593,9 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
req = nm_device_get_act_request (device);
g_return_val_if_fail (req, NM_ACT_STAGE_RETURN_FAILURE);
- return nm_modem_act_stage1_prepare (NM_DEVICE_MODEM_GET_PRIVATE (device)->modem, req, out_failure_reason);
+ return nm_modem_act_stage1_prepare (NM_DEVICE_MODEM_GET_PRIVATE (device)->modem,
+ req,
+ out_failure_reason);
}
static NMActStageReturn