Skip to content

Commit

Permalink
netem: eliminate unneeded return values
Browse files Browse the repository at this point in the history
All these individual parsing functions never return an error,
so they can be void.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Nov 4, 2008
1 parent babcda7 commit 265eb67
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions net/sched/sch_netem.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,35 +352,32 @@ static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr)
return 0;
}

static int get_correlation(struct Qdisc *sch, const struct nlattr *attr)
static void get_correlation(struct Qdisc *sch, const struct nlattr *attr)
{
struct netem_sched_data *q = qdisc_priv(sch);
const struct tc_netem_corr *c = nla_data(attr);

init_crandom(&q->delay_cor, c->delay_corr);
init_crandom(&q->loss_cor, c->loss_corr);
init_crandom(&q->dup_cor, c->dup_corr);
return 0;
}

static int get_reorder(struct Qdisc *sch, const struct nlattr *attr)
static void get_reorder(struct Qdisc *sch, const struct nlattr *attr)
{
struct netem_sched_data *q = qdisc_priv(sch);
const struct tc_netem_reorder *r = nla_data(attr);

q->reorder = r->probability;
init_crandom(&q->reorder_cor, r->correlation);
return 0;
}

static int get_corrupt(struct Qdisc *sch, const struct nlattr *attr)
static void get_corrupt(struct Qdisc *sch, const struct nlattr *attr)
{
struct netem_sched_data *q = qdisc_priv(sch);
const struct tc_netem_corrupt *r = nla_data(attr);

q->corrupt = r->probability;
init_crandom(&q->corrupt_cor, r->correlation);
return 0;
}

static const struct nla_policy netem_policy[TCA_NETEM_MAX + 1] = {
Expand Down Expand Up @@ -439,29 +436,20 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt)
if (q->gap)
q->reorder = ~0;

if (tb[TCA_NETEM_CORR]) {
ret = get_correlation(sch, tb[TCA_NETEM_CORR]);
if (ret)
return ret;
}
if (tb[TCA_NETEM_CORR])
get_correlation(sch, tb[TCA_NETEM_CORR]);

if (tb[TCA_NETEM_DELAY_DIST]) {
ret = get_dist_table(sch, tb[TCA_NETEM_DELAY_DIST]);
if (ret)
return ret;
}

if (tb[TCA_NETEM_REORDER]) {
ret = get_reorder(sch, tb[TCA_NETEM_REORDER]);
if (ret)
return ret;
}
if (tb[TCA_NETEM_REORDER])
get_reorder(sch, tb[TCA_NETEM_REORDER]);

if (tb[TCA_NETEM_CORRUPT]) {
ret = get_corrupt(sch, tb[TCA_NETEM_CORRUPT]);
if (ret)
return ret;
}
if (tb[TCA_NETEM_CORRUPT])
get_corrupt(sch, tb[TCA_NETEM_CORRUPT]);

return 0;
}
Expand Down

0 comments on commit 265eb67

Please sign in to comment.