netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: net_cls: remove a NULL check for css_cls_state
@ 2018-04-19  4:59 Li RongQing
  2018-04-20 14:37 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Li RongQing @ 2018-04-19  4:59 UTC (permalink / raw)
  To: netdev

The input of css_cls_state() is impossible to NULL except
cgrp_css_online, so simplify it

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 net/core/netclassid_cgroup.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/core/netclassid_cgroup.c b/net/core/netclassid_cgroup.c
index 5e4f04004a49..ee087cf793c2 100644
--- a/net/core/netclassid_cgroup.c
+++ b/net/core/netclassid_cgroup.c
@@ -19,7 +19,7 @@
 
 static inline struct cgroup_cls_state *css_cls_state(struct cgroup_subsys_state *css)
 {
-	return css ? container_of(css, struct cgroup_cls_state, css) : NULL;
+	return container_of(css, struct cgroup_cls_state, css);
 }
 
 struct cgroup_cls_state *task_cls_state(struct task_struct *p)
@@ -44,10 +44,9 @@ cgrp_css_alloc(struct cgroup_subsys_state *parent_css)
 static int cgrp_css_online(struct cgroup_subsys_state *css)
 {
 	struct cgroup_cls_state *cs = css_cls_state(css);
-	struct cgroup_cls_state *parent = css_cls_state(css->parent);
 
-	if (parent)
-		cs->classid = parent->classid;
+	if (css->parent)
+		cs->classid = css_cls_state(css->parent)->classid;
 
 	return 0;
 }
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-25 15:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-19  4:59 [PATCH] net: net_cls: remove a NULL check for css_cls_state Li RongQing
2018-04-20 14:37 ` David Miller
2018-04-25  8:35   ` Li RongQing
2018-04-25 15:00     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).