@@ -1020,7 +1020,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
1020
1020
#endif
1021
1021
1022
1022
err = - ENOENT ;
1023
- if (ops == NULL )
1023
+ if (! ops )
1024
1024
goto err_out ;
1025
1025
1026
1026
sch = qdisc_alloc (dev_queue , ops );
@@ -1060,54 +1060,60 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
1060
1060
netdev_info (dev , "Caught tx_queue_len zero misconfig\n" );
1061
1061
}
1062
1062
1063
- if (!ops -> init || (err = ops -> init (sch , tca [TCA_OPTIONS ])) == 0 ) {
1064
- if (qdisc_is_percpu_stats (sch )) {
1065
- sch -> cpu_bstats =
1066
- netdev_alloc_pcpu_stats (struct gnet_stats_basic_cpu );
1067
- if (!sch -> cpu_bstats )
1068
- goto err_out4 ;
1069
-
1070
- sch -> cpu_qstats = alloc_percpu (struct gnet_stats_queue );
1071
- if (!sch -> cpu_qstats )
1072
- goto err_out4 ;
1073
- }
1063
+ if (ops -> init ) {
1064
+ err = ops -> init (sch , tca [TCA_OPTIONS ]);
1065
+ if (err != 0 )
1066
+ goto err_out5 ;
1067
+ }
1074
1068
1075
- if (tca [TCA_STAB ]) {
1076
- stab = qdisc_get_stab (tca [TCA_STAB ]);
1077
- if (IS_ERR (stab )) {
1078
- err = PTR_ERR (stab );
1079
- goto err_out4 ;
1080
- }
1081
- rcu_assign_pointer (sch -> stab , stab );
1082
- }
1083
- if (tca [TCA_RATE ]) {
1084
- seqcount_t * running ;
1069
+ if (qdisc_is_percpu_stats (sch )) {
1070
+ sch -> cpu_bstats =
1071
+ netdev_alloc_pcpu_stats (struct gnet_stats_basic_cpu );
1072
+ if (!sch -> cpu_bstats )
1073
+ goto err_out4 ;
1085
1074
1086
- err = - EOPNOTSUPP ;
1087
- if (sch -> flags & TCQ_F_MQROOT )
1088
- goto err_out4 ;
1075
+ sch -> cpu_qstats = alloc_percpu (struct gnet_stats_queue );
1076
+ if (!sch -> cpu_qstats )
1077
+ goto err_out4 ;
1078
+ }
1089
1079
1090
- if ((sch -> parent != TC_H_ROOT ) &&
1091
- !(sch -> flags & TCQ_F_INGRESS ) &&
1092
- (!p || !(p -> flags & TCQ_F_MQROOT )))
1093
- running = qdisc_root_sleeping_running (sch );
1094
- else
1095
- running = & sch -> running ;
1096
-
1097
- err = gen_new_estimator (& sch -> bstats ,
1098
- sch -> cpu_bstats ,
1099
- & sch -> rate_est ,
1100
- NULL ,
1101
- running ,
1102
- tca [TCA_RATE ]);
1103
- if (err )
1104
- goto err_out4 ;
1080
+ if (tca [TCA_STAB ]) {
1081
+ stab = qdisc_get_stab (tca [TCA_STAB ]);
1082
+ if (IS_ERR (stab )) {
1083
+ err = PTR_ERR (stab );
1084
+ goto err_out4 ;
1105
1085
}
1086
+ rcu_assign_pointer (sch -> stab , stab );
1087
+ }
1088
+ if (tca [TCA_RATE ]) {
1089
+ seqcount_t * running ;
1106
1090
1107
- qdisc_hash_add (sch , false);
1091
+ err = - EOPNOTSUPP ;
1092
+ if (sch -> flags & TCQ_F_MQROOT )
1093
+ goto err_out4 ;
1108
1094
1109
- return sch ;
1095
+ if (sch -> parent != TC_H_ROOT &&
1096
+ !(sch -> flags & TCQ_F_INGRESS ) &&
1097
+ (!p || !(p -> flags & TCQ_F_MQROOT )))
1098
+ running = qdisc_root_sleeping_running (sch );
1099
+ else
1100
+ running = & sch -> running ;
1101
+
1102
+ err = gen_new_estimator (& sch -> bstats ,
1103
+ sch -> cpu_bstats ,
1104
+ & sch -> rate_est ,
1105
+ NULL ,
1106
+ running ,
1107
+ tca [TCA_RATE ]);
1108
+ if (err )
1109
+ goto err_out4 ;
1110
1110
}
1111
+
1112
+ qdisc_hash_add (sch , false);
1113
+
1114
+ return sch ;
1115
+
1116
+ err_out5 :
1111
1117
/* ops->init() failed, we call ->destroy() like qdisc_create_dflt() */
1112
1118
if (ops -> destroy )
1113
1119
ops -> destroy (sch );
@@ -1139,7 +1145,7 @@ static int qdisc_change(struct Qdisc *sch, struct nlattr **tca)
1139
1145
int err = 0 ;
1140
1146
1141
1147
if (tca [TCA_OPTIONS ]) {
1142
- if (sch -> ops -> change == NULL )
1148
+ if (! sch -> ops -> change )
1143
1149
return - EINVAL ;
1144
1150
err = sch -> ops -> change (sch , tca [TCA_OPTIONS ]);
1145
1151
if (err )
@@ -1344,7 +1350,8 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
1344
1350
goto create_n_graft ;
1345
1351
if (n -> nlmsg_flags & NLM_F_EXCL )
1346
1352
return - EEXIST ;
1347
- if (tca [TCA_KIND ] && nla_strcmp (tca [TCA_KIND ], q -> ops -> id ))
1353
+ if (tca [TCA_KIND ] &&
1354
+ nla_strcmp (tca [TCA_KIND ], q -> ops -> id ))
1348
1355
return - EINVAL ;
1349
1356
if (q == p ||
1350
1357
(p && check_loop (q , p , 0 )))
@@ -1389,7 +1396,7 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
1389
1396
}
1390
1397
1391
1398
/* Change qdisc parameters */
1392
- if (q == NULL )
1399
+ if (! q )
1393
1400
return - ENOENT ;
1394
1401
if (n -> nlmsg_flags & NLM_F_EXCL )
1395
1402
return - EEXIST ;
0 commit comments