From 49769d417552e7f356011a433d8c76d20ad24263 Mon Sep 17 00:00:00 2001 From: Kamalesh Babulal Date: Wed, 16 Mar 2022 21:37:14 +0530 Subject: [PATCH] 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 --- samples/c/read_stats.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) 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", -- 2.47.2