Commit ac8ef4ab authored by Alexander Aring's avatar Alexander Aring Committed by David S. Miller

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: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarAlexander Aring <aring@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8f36e000
...@@ -669,7 +669,7 @@ int qdisc_class_hash_init(struct Qdisc_class_hash *clhash) ...@@ -669,7 +669,7 @@ int qdisc_class_hash_init(struct Qdisc_class_hash *clhash)
unsigned int size = 4; unsigned int size = 4;
clhash->hash = qdisc_class_hash_alloc(size); clhash->hash = qdisc_class_hash_alloc(size);
if (clhash->hash == NULL) if (!clhash->hash)
return -ENOMEM; return -ENOMEM;
clhash->hashsize = size; clhash->hashsize = size;
clhash->hashmask = size - 1; clhash->hashmask = size - 1;
......
...@@ -1150,12 +1150,13 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -1150,12 +1150,13 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
if (err < 0) if (err < 0)
return err; return err;
if (tb[TCA_CBQ_RTAB] == NULL || tb[TCA_CBQ_RATE] == NULL) if (!tb[TCA_CBQ_RTAB] || !tb[TCA_CBQ_RATE])
return -EINVAL; return -EINVAL;
r = nla_data(tb[TCA_CBQ_RATE]); r = nla_data(tb[TCA_CBQ_RATE]);
if ((q->link.R_tab = qdisc_get_rtab(r, tb[TCA_CBQ_RTAB])) == NULL) q->link.R_tab = qdisc_get_rtab(r, tb[TCA_CBQ_RTAB]);
if (!q->link.R_tab)
return -EINVAL; return -EINVAL;
err = tcf_block_get(&q->link.block, &q->link.filter_list, sch); 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 ...@@ -1460,7 +1461,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
struct cbq_class *parent; struct cbq_class *parent;
struct qdisc_rate_table *rtab = NULL; struct qdisc_rate_table *rtab = NULL;
if (opt == NULL) if (!opt)
return -EINVAL; return -EINVAL;
err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy, NULL); 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 ...@@ -1532,8 +1533,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
if (parentid == TC_H_ROOT) if (parentid == TC_H_ROOT)
return -EINVAL; return -EINVAL;
if (tb[TCA_CBQ_WRROPT] == NULL || tb[TCA_CBQ_RATE] == NULL || if (!tb[TCA_CBQ_WRROPT] || !tb[TCA_CBQ_RATE] || !tb[TCA_CBQ_LSSOPT])
tb[TCA_CBQ_LSSOPT] == NULL)
return -EINVAL; return -EINVAL;
rtab = qdisc_get_rtab(nla_data(tb[TCA_CBQ_RATE]), tb[TCA_CBQ_RTAB]); 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 ...@@ -1565,7 +1565,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
if (parentid) { if (parentid) {
parent = cbq_class_lookup(q, parentid); parent = cbq_class_lookup(q, parentid);
err = -EINVAL; err = -EINVAL;
if (parent == NULL) if (!parent)
goto failure; goto failure;
} }
......
...@@ -306,12 +306,13 @@ static inline int gred_change_table_def(struct Qdisc *sch, struct nlattr *dps) ...@@ -306,12 +306,13 @@ static inline int gred_change_table_def(struct Qdisc *sch, struct nlattr *dps)
struct tc_gred_sopt *sopt; struct tc_gred_sopt *sopt;
int i; int i;
if (dps == NULL) if (!dps)
return -EINVAL; return -EINVAL;
sopt = nla_data(dps); sopt = nla_data(dps);
if (sopt->DPs > MAX_DPs || sopt->DPs == 0 || sopt->def_DP >= sopt->DPs) if (sopt->DPs > MAX_DPs || sopt->DPs == 0 ||
sopt->def_DP >= sopt->DPs)
return -EINVAL; return -EINVAL;
sch_tree_lock(sch); sch_tree_lock(sch);
...@@ -470,7 +471,7 @@ static int gred_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -470,7 +471,7 @@ static int gred_init(struct Qdisc *sch, struct nlattr *opt)
struct nlattr *tb[TCA_GRED_MAX + 1]; struct nlattr *tb[TCA_GRED_MAX + 1];
int err; int err;
if (opt == NULL) if (!opt)
return -EINVAL; return -EINVAL;
err = nla_parse_nested(tb, TCA_GRED_MAX, opt, gred_policy, NULL); err = nla_parse_nested(tb, TCA_GRED_MAX, opt, gred_policy, NULL);
......
...@@ -1396,7 +1396,7 @@ hfsc_init_qdisc(struct Qdisc *sch, struct nlattr *opt) ...@@ -1396,7 +1396,7 @@ hfsc_init_qdisc(struct Qdisc *sch, struct nlattr *opt)
qdisc_watchdog_init(&q->watchdog, sch); qdisc_watchdog_init(&q->watchdog, sch);
if (opt == NULL || nla_len(opt) < sizeof(*qopt)) if (!opt || nla_len(opt) < sizeof(*qopt))
return -EINVAL; return -EINVAL;
qopt = nla_data(opt); qopt = nla_data(opt);
......
...@@ -243,7 +243,7 @@ static int multiq_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -243,7 +243,7 @@ static int multiq_init(struct Qdisc *sch, struct nlattr *opt)
q->queues = NULL; q->queues = NULL;
if (opt == NULL) if (!opt)
return -EINVAL; return -EINVAL;
err = tcf_block_get(&q->block, &q->filter_list, sch); err = tcf_block_get(&q->block, &q->filter_list, sch);
......
...@@ -428,7 +428,7 @@ static int tbf_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -428,7 +428,7 @@ static int tbf_init(struct Qdisc *sch, struct nlattr *opt)
qdisc_watchdog_init(&q->watchdog, sch); qdisc_watchdog_init(&q->watchdog, sch);
q->qdisc = &noop_qdisc; q->qdisc = &noop_qdisc;
if (opt == NULL) if (!opt)
return -EINVAL; return -EINVAL;
q->t_c = ktime_get_ns(); q->t_c = ktime_get_ns();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment