Use list_for_each_entry() instead of list_for_each() to simplify
the code.

Signed-off-by: Geliang Tang <geliangt...@163.com>
---
 net/sched/sch_htb.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 15ccd7f..5f7aa74 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -948,10 +948,9 @@ static unsigned int htb_drop(struct Qdisc *sch)
        int prio;
 
        for (prio = TC_HTB_NUMPRIO - 1; prio >= 0; prio--) {
-               struct list_head *p;
-               list_for_each(p, q->drops + prio) {
-                       struct htb_class *cl = list_entry(p, struct htb_class,
-                                                         un.leaf.drop_list);
+               struct htb_class *cl;
+
+               list_for_each_entry(cl, q->drops + prio, un.leaf.drop_list) {
                        unsigned int len;
                        if (cl->un.leaf.q->ops->drop &&
                            (len = cl->un.leaf.q->ops->drop(cl->un.leaf.q))) {
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to