mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 18:10:08 +01:00
merge: branch 'ih/fec-uninit-var'
core: fail early if we cannot get current FEC value https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2177
This commit is contained in:
commit
a4401ae0a6
1 changed files with 10 additions and 9 deletions
|
|
@ -2788,22 +2788,23 @@ _ethtool_fec_set(NMDevice *self,
|
|||
|
||||
g_hash_table_iter_init(&iter, hash);
|
||||
while (g_hash_table_iter_next(&iter, (gpointer *) &name, (gpointer *) &variant)) {
|
||||
NMEthtoolID ethtool_id = nm_ethtool_id_get_by_name(name);
|
||||
|
||||
if (!nm_ethtool_id_is_fec(ethtool_id))
|
||||
continue;
|
||||
|
||||
nm_assert(g_variant_is_of_type(variant, G_VARIANT_TYPE_UINT32));
|
||||
fec_mode = g_variant_get_uint32(variant);
|
||||
if (nm_ethtool_id_is_fec(nm_ethtool_id_get_by_name(name))) {
|
||||
nm_assert(g_variant_is_of_type(variant, G_VARIANT_TYPE_UINT32));
|
||||
fec_mode = g_variant_get_uint32(variant);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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