summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-08-24 17:35:59 (GMT)
committerThomas Haller <thaller@redhat.com>2022-08-24 17:41:42 (GMT)
commit1f1e8385049026ecb050f75b3aa83a3a09a70169 (patch)
treecfa08f72912526b12ccc055cff6734eb34c5d9d7
parent2bc30e57f4f963fdf8b5d7ef861424cce847ae50 (diff)
downloadlibnl-1f1e8385049026ecb050f75b3aa83a3a09a70169.zip
libnl-1f1e8385049026ecb050f75b3aa83a3a09a70169.tar.gz
libnl-1f1e8385049026ecb050f75b3aa83a3a09a70169.tar.bz2
route/vlan: drop unnecessary "else" in vlan_put_attrs()
-rw-r--r--lib/route/link/vlan.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/route/link/vlan.c b/lib/route/link/vlan.c
index af1c193..adb86a7 100644
--- a/lib/route/link/vlan.c
+++ b/lib/route/link/vlan.c
@@ -288,12 +288,12 @@ static int vlan_put_attrs(struct nl_msg *msg, struct rtnl_link *link)
{
struct vlan_info *vi = link->l_info;
struct nlattr *data;
- int32_t nest_count = 0;
+ int nest_count = 0;
if (!(data = nla_nest_start(msg, IFLA_INFO_DATA)))
goto nla_put_failure;
- else
- nest_count++;
+
+ nest_count++;
if (vi->vi_mask & VLAN_HAS_ID)
NLA_PUT_U16(msg, IFLA_VLAN_ID, vi->vi_vlan_id);
@@ -317,8 +317,8 @@ static int vlan_put_attrs(struct nl_msg *msg, struct rtnl_link *link)
if (!(qos = nla_nest_start(msg, IFLA_VLAN_INGRESS_QOS)))
goto nla_put_failure;
- else
- nest_count++;
+
+ nest_count++;
for (i = 0; i <= VLAN_PRIO_MAX; i++) {
if (vi->vi_ingress_qos_mask & (1 << i)) {
@@ -340,8 +340,8 @@ static int vlan_put_attrs(struct nl_msg *msg, struct rtnl_link *link)
if (!(qos = nla_nest_start(msg, IFLA_VLAN_EGRESS_QOS)))
goto nla_put_failure;
- else
- nest_count++;
+
+ nest_count++;
for (i = 0; i < vi->vi_negress; i++) {
map.from = vi->vi_egress_qos[i].vm_from;
@@ -355,13 +355,11 @@ static int vlan_put_attrs(struct nl_msg *msg, struct rtnl_link *link)
}
nla_nest_end(msg, data);
- nest_count--;
return 0;
nla_put_failure:
- for(uint32_t i = 0; i < nest_count; i++) {
+ for (; nest_count > 0; nest_count--)
nla_nest_cancel(msg, data);
- }
return -NLE_MSGSIZE;
}