Thread (37 messages) 37 messages, 6 authors, 2016-09-12

[RFC Patch net-next 3/6] net_sched: return NULL in tcf_hash_check()

flat view
STALE3688d

From: Cong Wang <hidden>
Date: 2016-09-02 05:57:48
Subsystem: networking [general], tc subsystem, the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jamal Hadi Salim, Jiri Pirko, Linus Torvalds

When we don't find an action with a specific index,
we only return false but not touch *a. It is nicer
if we could set *a to NULL here, this would make
callers easier to use these API's.

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Cong Wang <redacted>
---
 net/sched/act_api.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index db907e5..d0a7db2 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -230,6 +230,7 @@ bool tcf_hash_check(struct tc_action_net *tn, u32 index, struct tc_action **a,
 		*a = p;
 		return true;
 	}
+	*a = NULL;
 	return false;
 }
 EXPORT_SYMBOL(tcf_hash_check);
-- 
2.1.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help