summaryrefslogtreecommitdiff
path: root/tools/perf/util/cgroup.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2018-03-06 16:08:10 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-03-07 16:22:25 +0300
commit9450d0d46c895cae99e922145aca20bd30533bc6 (patch)
tree6b37972c6ba20402cd22bd9febe8fb576cede927 /tools/perf/util/cgroup.c
parent3ca32f69592be4d667c701763335fa496a0ede1d (diff)
downloadlinux-9450d0d46c895cae99e922145aca20bd30533bc6.tar.xz
perf cgroup: Introduce cgroup__delete()
Just to make this code look more like other places in tools/perf. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Stephane Eranian <eranian@google.com> Cc: Wang Nan <wangnan0@huawei.com> Link: https://lkml.kernel.org/n/tip-j3j72vvn2d5j7tenlghdy195@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/cgroup.c')
-rw-r--r--tools/perf/util/cgroup.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c
index 6ce291f45f2d..4dd52feb1ae6 100644
--- a/tools/perf/util/cgroup.c
+++ b/tools/perf/util/cgroup.c
@@ -144,12 +144,17 @@ found:
return 0;
}
+static void cgroup__delete(struct cgroup *cgroup)
+{
+ close(cgroup->fd);
+ zfree(&cgroup->name);
+ free(cgroup);
+}
+
void close_cgroup(struct cgroup *cgrp)
{
if (cgrp && refcount_dec_and_test(&cgrp->refcnt)) {
- close(cgrp->fd);
- zfree(&cgrp->name);
- free(cgrp);
+ cgroup__delete(cgrp);
}
}