Commit f29374b146dd02f5f99742aedaddd6ef3512fc9c

Authored by Zefan Li
Committed by Tejun Heo
1 parent 52de4779f2

cgroup: remove redundant check in cgroup_ino()

After we implemented default unified hierarchy, cgrp->kn can never
be NULL.

Signed-off-by: Zefan Li <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

Showing 2 changed files with 3 additions and 6 deletions Side-by-side Diff

include/linux/cgroup.h
... ... @@ -532,13 +532,10 @@
532 532 return !list_empty(&cgrp->cset_links);
533 533 }
534 534  
535   -/* returns ino associated with a cgroup, 0 indicates unmounted root */
  535 +/* returns ino associated with a cgroup */
536 536 static inline ino_t cgroup_ino(struct cgroup *cgrp)
537 537 {
538   - if (cgrp->kn)
539   - return cgrp->kn->ino;
540   - else
541   - return 0;
  538 + return cgrp->kn->ino;
542 539 }
543 540  
544 541 /* cft/css accessors for cftype->write() operation */
... ... @@ -148,7 +148,7 @@
148 148 ino = cgroup_ino(css->cgroup);
149 149 css_put(css);
150 150  
151   - if (!ino || ino != hwpoison_filter_memcg)
  151 + if (ino != hwpoison_filter_memcg)
152 152 return -EINVAL;
153 153  
154 154 return 0;