Skip to contentSkip to conversation

net_sched: remove unnecessary null pointer check

PATCH In review Yang Yingliang 2 participants 4 messages Dec 17, 2013 – Dec 19, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover net_sched: remove unnecessary null pointer check

Remove unnecessary null pointer check outside of qdisc_put_rtab().

Yang Yingliang (2):
act_police: remove unnecessary null pointer check
sch_cbq: remove unnecessary null pointer check

 net/sched/act_police.c | 6 ++----
 net/sched/sch_cbq.c    | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)
Signature · 1 line
1.8.0
#1 lore raw

PATCH 1/2 act_police: remove unnecessary null pointer check

It already has a NULL pointer check of rtab in qdisc_put_rtab(). Remove the check outside of qdisc_put_rtab().

---
 net/sched/act_police.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
net/sched/act_police.c +2 -4
index 16a62c3..cf01c97 100644
@@ -277,10 +277,8 @@ override:
 failure_unlock:
 	spin_unlock_bh(&police->tcf_lock);
 failure:
-	if (P_tab)
-		qdisc_put_rtab(P_tab);
-	if (R_tab)
-		qdisc_put_rtab(R_tab);
+	qdisc_put_rtab(P_tab);
+	qdisc_put_rtab(R_tab);
 	if (ret == ACT_P_CREATED)
 		kfree(police);
 	return err;
Signature · 1 line
1.8.0
#2 lore raw

PATCH 2/2 sch_cbq: remove unnecessary null pointer check

In reply to Yang Yingliang

It already has a NULL pointer check of rtab in qdisc_put_rtab(). Remove the check outside of qdisc_put_rtab().

---
 net/sched/sch_cbq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/sched/sch_cbq.c +1 -2
index d5a8a4b..e251833 100644
@@ -1783,8 +1783,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
 						    qdisc_root_sleeping_lock(sch),
 						    tca[TCA_RATE]);
 			if (err) {
-				if (rtab)
-					qdisc_put_rtab(rtab);
+				qdisc_put_rtab(rtab);
 				return err;
 			}
 		}
Signature · 1 line
1.8.0