mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 15:30:11 +01:00
core: fail early if we cannot get current FEC value
If we cannot get current FEC value probably we won't be able to set it a few lines later. Also, if it fails to set, we try to use the value of the old one that we tried to retrieve without success. In that case, the variable old_fec_mode would be uninitialized. Fix it by returning early if we cannot get the current value. Fixes:19bed3121f('ethtool: support Forward Error Correction(fec)') (cherry picked from commitcbdd0d9cca)
This commit is contained in:
parent
1ace58c0c2
commit
b7e34f225a
1 changed files with 5 additions and 2 deletions
|
|
@ -2768,13 +2768,16 @@ _ethtool_fec_set(NMDevice *self,
|
|||
fec_mode = g_variant_get_uint32(variant);
|
||||
}
|
||||
|
||||
nm_platform_ethtool_get_fec_mode(platform, ethtool_state->ifindex, &old_fec_mode);
|
||||
|
||||
/* The NM_SETTING_ETHTOOL_FEC_MODE_NONE is query only value, hence do nothing. */
|
||||
if (!fec_mode || fec_mode == NM_SETTING_ETHTOOL_FEC_MODE_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!nm_platform_ethtool_get_fec_mode(platform, ethtool_state->ifindex, &old_fec_mode)) {
|
||||
_LOGW(LOGD_DEVICE, "ethtool: failure setting FEC %d: cannot get current value", fec_mode);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!nm_platform_ethtool_set_fec_mode(platform, ethtool_state->ifindex, fec_mode))
|
||||
_LOGW(LOGD_DEVICE, "ethtool: failure setting FEC %d", fec_mode);
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue