Skip to content

Commit

Permalink
net/sched: taprio: don't overwrite "sch" variable in taprio_dump_clas…
Browse files Browse the repository at this point in the history
…s_stats()

In taprio_dump_class_stats() we don't need a reference to the root Qdisc
once we get the reference to the child corresponding to this traffic
class, so it's okay to overwrite "sch". But in a future patch we will
need the root Qdisc too, so create a dedicated "child" pointer variable
to hold the child reference. This also makes the code adhere to a more
conventional coding style.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vladimir Oltean authored and David S. Miller committed May 31, 2023
1 parent 5dedf5c commit dced11e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/sched/sch_taprio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2388,10 +2388,10 @@ static int taprio_dump_class_stats(struct Qdisc *sch, unsigned long cl,
__acquires(d->lock)
{
struct netdev_queue *dev_queue = taprio_queue_get(sch, cl);
struct Qdisc *child = dev_queue->qdisc_sleeping;

sch = dev_queue->qdisc_sleeping;
if (gnet_stats_copy_basic(d, NULL, &sch->bstats, true) < 0 ||
qdisc_qstats_copy(d, sch) < 0)
if (gnet_stats_copy_basic(d, NULL, &child->bstats, true) < 0 ||
qdisc_qstats_copy(d, child) < 0)
return -1;
return 0;
}
Expand Down

0 comments on commit dced11e

Please sign in to comment.