Skip to content

Commit ac8ef4a

Browse files
Alexander Aringdavem330
authored andcommitted
net: sched: fix coding style issues
This patch fix checkpatch issues for upcomming patches according to the sched api file. It changes mostly how to check on null pointer. Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: Alexander Aring <aring@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8f36e00 commit ac8ef4a

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

net/sched/sch_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ int qdisc_class_hash_init(struct Qdisc_class_hash *clhash)
669669
unsigned int size = 4;
670670

671671
clhash->hash = qdisc_class_hash_alloc(size);
672-
if (clhash->hash == NULL)
672+
if (!clhash->hash)
673673
return -ENOMEM;
674674
clhash->hashsize = size;
675675
clhash->hashmask = size - 1;

net/sched/sch_cbq.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,12 +1150,13 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
11501150
if (err < 0)
11511151
return err;
11521152

1153-
if (tb[TCA_CBQ_RTAB] == NULL || tb[TCA_CBQ_RATE] == NULL)
1153+
if (!tb[TCA_CBQ_RTAB] || !tb[TCA_CBQ_RATE])
11541154
return -EINVAL;
11551155

11561156
r = nla_data(tb[TCA_CBQ_RATE]);
11571157

1158-
if ((q->link.R_tab = qdisc_get_rtab(r, tb[TCA_CBQ_RTAB])) == NULL)
1158+
q->link.R_tab = qdisc_get_rtab(r, tb[TCA_CBQ_RTAB]);
1159+
if (!q->link.R_tab)
11591160
return -EINVAL;
11601161

11611162
err = tcf_block_get(&q->link.block, &q->link.filter_list, sch);
@@ -1460,7 +1461,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
14601461
struct cbq_class *parent;
14611462
struct qdisc_rate_table *rtab = NULL;
14621463

1463-
if (opt == NULL)
1464+
if (!opt)
14641465
return -EINVAL;
14651466

14661467
err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy, NULL);
@@ -1532,8 +1533,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
15321533
if (parentid == TC_H_ROOT)
15331534
return -EINVAL;
15341535

1535-
if (tb[TCA_CBQ_WRROPT] == NULL || tb[TCA_CBQ_RATE] == NULL ||
1536-
tb[TCA_CBQ_LSSOPT] == NULL)
1536+
if (!tb[TCA_CBQ_WRROPT] || !tb[TCA_CBQ_RATE] || !tb[TCA_CBQ_LSSOPT])
15371537
return -EINVAL;
15381538

15391539
rtab = qdisc_get_rtab(nla_data(tb[TCA_CBQ_RATE]), tb[TCA_CBQ_RTAB]);
@@ -1565,7 +1565,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
15651565
if (parentid) {
15661566
parent = cbq_class_lookup(q, parentid);
15671567
err = -EINVAL;
1568-
if (parent == NULL)
1568+
if (!parent)
15691569
goto failure;
15701570
}
15711571

net/sched/sch_gred.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,13 @@ static inline int gred_change_table_def(struct Qdisc *sch, struct nlattr *dps)
306306
struct tc_gred_sopt *sopt;
307307
int i;
308308

309-
if (dps == NULL)
309+
if (!dps)
310310
return -EINVAL;
311311

312312
sopt = nla_data(dps);
313313

314-
if (sopt->DPs > MAX_DPs || sopt->DPs == 0 || sopt->def_DP >= sopt->DPs)
314+
if (sopt->DPs > MAX_DPs || sopt->DPs == 0 ||
315+
sopt->def_DP >= sopt->DPs)
315316
return -EINVAL;
316317

317318
sch_tree_lock(sch);
@@ -470,7 +471,7 @@ static int gred_init(struct Qdisc *sch, struct nlattr *opt)
470471
struct nlattr *tb[TCA_GRED_MAX + 1];
471472
int err;
472473

473-
if (opt == NULL)
474+
if (!opt)
474475
return -EINVAL;
475476

476477
err = nla_parse_nested(tb, TCA_GRED_MAX, opt, gred_policy, NULL);

net/sched/sch_hfsc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,7 @@ hfsc_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
13961396

13971397
qdisc_watchdog_init(&q->watchdog, sch);
13981398

1399-
if (opt == NULL || nla_len(opt) < sizeof(*qopt))
1399+
if (!opt || nla_len(opt) < sizeof(*qopt))
14001400
return -EINVAL;
14011401
qopt = nla_data(opt);
14021402

net/sched/sch_multiq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static int multiq_init(struct Qdisc *sch, struct nlattr *opt)
243243

244244
q->queues = NULL;
245245

246-
if (opt == NULL)
246+
if (!opt)
247247
return -EINVAL;
248248

249249
err = tcf_block_get(&q->block, &q->filter_list, sch);

net/sched/sch_tbf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ static int tbf_init(struct Qdisc *sch, struct nlattr *opt)
428428
qdisc_watchdog_init(&q->watchdog, sch);
429429
q->qdisc = &noop_qdisc;
430430

431-
if (opt == NULL)
431+
if (!opt)
432432
return -EINVAL;
433433

434434
q->t_c = ktime_get_ns();

0 commit comments

Comments
 (0)