From: Vladimir Oltean Date: Tue, 30 May 2023 09:19:44 +0000 (+0300) Subject: net/sched: taprio: don't overwrite "sch" variable in taprio_dump_class_stats() X-Git-Tag: v6.6.17~4555^2~195^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dced11ef84fb310f4ddfa74d1c09687b8f845d1b;p=platform%2Fkernel%2Flinux-rpi.git net/sched: taprio: don't overwrite "sch" variable in taprio_dump_class_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 Acked-by: Vinicius Costa Gomes Signed-off-by: David S. Miller --- diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 76db9a1..d29e678 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -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; }