From: Kamalesh Babulal Date: Wed, 16 Mar 2022 16:07:14 +0000 (+0530) Subject: samples/read_stats.c: fix checkpatch.pl warnings X-Git-Tag: v3.0~149 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49769d417552e7f356011a433d8c76d20ad24263;p=thirdparty%2Flibcgroup.git samples/read_stats.c: fix checkpatch.pl warnings Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl, except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local variable declarations and header file reordering. In summary, this patch fixes the following checkpatch.pl recommendations: total: 0 errors, 0 warnings, 84 lines checked Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/samples/c/read_stats.c b/samples/c/read_stats.c index 34eef4f9..92974d1e 100644 --- a/samples/c/read_stats.c +++ b/samples/c/read_stats.c @@ -1,19 +1,20 @@ // SPDX-License-Identifier: LGPL-2.1-only -#include +#include + #include -#include #include #include -#include +#include + +#include int read_stats(char *path, char *controller) { - int ret; - void *handle; struct cgroup_stat stat; + void *handle; + int ret; ret = cgroup_read_stats_begin(controller, path, &handle, &stat); - if (ret != 0) { fprintf(stderr, "stats read failed\n"); return -1; @@ -34,13 +35,13 @@ int read_stats(char *path, char *controller) int main(int argc, char *argv[]) { - int ret; - char *controller; - void *handle; struct cgroup_file_info info; - int lvl; char cgroup_path[FILENAME_MAX]; + char *controller; int root_len; + void *handle; + int lvl; + int ret; if (argc < 2) { fprintf(stderr, "Usage %s: \n",