From 556ebdbf4a72d8d362d4f1b67389d227ad05ab8c Mon Sep 17 00:00:00 2001 From: Kamalesh Babulal Date: Wed, 16 Mar 2022 21:25:22 +0530 Subject: [PATCH] samples/get_controller.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: 1 errors, 0 warnings, 34 lines checked Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- samples/c/get_controller.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/samples/c/get_controller.c b/samples/c/get_controller.c index 3c1421b7..6115bc97 100644 --- a/samples/c/get_controller.c +++ b/samples/c/get_controller.c @@ -1,30 +1,29 @@ // SPDX-License-Identifier: LGPL-2.1-only #include -#include + #include +#include -int main() +int main(void) { - int error; - void *handle; struct cgroup_mount_point info; + void *handle; + int error; error = cgroup_init(); - if (error) { printf("cgroup_init failed with %s\n", cgroup_strerror(error)); exit(1); } error = cgroup_get_controller_begin(&handle, &info); - while (error != ECGEOF) { - printf("Controller %s is mounted at %s\n", info.name, - info.path); + printf("Controller %s is mounted at %s\n", + info.name, info.path); error = cgroup_get_controller_next(&handle, &info); if (error && error != ECGEOF) { - printf("cgroup_get_contrller_next failed with %s", - cgroup_strerror(error)); + printf("cgroup_get_controller_next failed with %s", + cgroup_strerror(error)); exit(1); } } -- 2.47.2