@@ -288,12 +288,12 @@ static int vlan_put_attrs(struct nl_msg *msg, struct rtnl_link *link)
288288{
289289 struct vlan_info * vi = link -> l_info ;
290290 struct nlattr * data ;
291- int32_t nest_count = 0 ;
291+ int nest_count = 0 ;
292292
293293 if (!(data = nla_nest_start (msg , IFLA_INFO_DATA )))
294294 goto nla_put_failure ;
295- else
296- nest_count ++ ;
295+
296+ nest_count ++ ;
297297
298298 if (vi -> vi_mask & VLAN_HAS_ID )
299299 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)
317317
318318 if (!(qos = nla_nest_start (msg , IFLA_VLAN_INGRESS_QOS )))
319319 goto nla_put_failure ;
320- else
321- nest_count ++ ;
320+
321+ nest_count ++ ;
322322
323323 for (i = 0 ; i <= VLAN_PRIO_MAX ; i ++ ) {
324324 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)
340340
341341 if (!(qos = nla_nest_start (msg , IFLA_VLAN_EGRESS_QOS )))
342342 goto nla_put_failure ;
343- else
344- nest_count ++ ;
343+
344+ nest_count ++ ;
345345
346346 for (i = 0 ; i < vi -> vi_negress ; i ++ ) {
347347 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)
355355 }
356356
357357 nla_nest_end (msg , data );
358- nest_count -- ;
359358 return 0 ;
360359
361360nla_put_failure :
362- for ( uint32_t i = 0 ; i < nest_count ; i ++ ) {
361+ for (; nest_count > 0 ; nest_count -- )
363362 nla_nest_cancel (msg , data );
364- }
365363 return - NLE_MSGSIZE ;
366364}
367365
0 commit comments