diff options
author | Thomas Haller <thaller@redhat.com> | 2017-02-22 17:04:00 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-02-22 21:37:47 +0100 |
commit | 437c12fc89e6da99ca3820ed23b6276d587ee2d4 (patch) | |
tree | 21591e43e8cb3e79667e788b9ad9ca3b9a0842b3 /src/devices/nm-device-bond.c | |
parent | d5911fc5515bbfd66c99b6bb30b61034c256ef4e (diff) | |
download | NetworkManager-437c12fc89e6da99ca3820ed23b6276d587ee2d4.tar.gz |
device: rename device-state-reason argument to out_failure_reason
This argument is only relevant when the NMActStageReturn argument
indicates NM_ACT_STAGE_RETURN_FAILURE. In all other cases it is ignored.
Rename the argument to make the meaning clearer. The argument is passed
through several layers of code, it isn't obvious that this argument only
matters for the failure case. Also, the distinct name makes it easier
to distinguish from other uses of the "reason" name.
While at it, do some drive-by cleanup:
- use g_return_*() instead of g_assert() to have a more graceful
assertion.
- functions like dhcp4_start() don't need to return a failure reason.
Most callers don't care, and the caller who does can determine the
proper reason.
- allow omitting the out-argument via NM_SET_OUT().
Diffstat (limited to 'src/devices/nm-device-bond.c')
-rw-r--r-- | src/devices/nm-device-bond.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c index 34d34eb43b..24c6a25f63 100644 --- a/src/devices/nm-device-bond.c +++ b/src/devices/nm-device-bond.c @@ -363,21 +363,19 @@ apply_bonding_config (NMDevice *device) } static NMActStageReturn -act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) +act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *out_failure_reason) { NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS; gboolean no_firmware = FALSE; - g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE); - - ret = NM_DEVICE_CLASS (nm_device_bond_parent_class)->act_stage1_prepare (dev, reason); + ret = NM_DEVICE_CLASS (nm_device_bond_parent_class)->act_stage1_prepare (dev, out_failure_reason); if (ret != NM_ACT_STAGE_RETURN_SUCCESS) return ret; /* Interface must be down to set bond options */ nm_device_take_down (dev, TRUE); ret = apply_bonding_config (dev); - if (ret) + if (ret != NM_ACT_STAGE_RETURN_FAILURE) ret = nm_device_hw_addr_set_cloned (dev, nm_device_get_applied_connection (dev), FALSE); nm_device_bring_up (dev, TRUE, &no_firmware); |