From: Kamalesh Babulal Date: Wed, 16 Mar 2022 15:55:22 +0000 (+0530) Subject: samples/get_controller.c: fix checkpatch.pl warnings X-Git-Tag: v3.0~155 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=556ebdbf4a72d8d362d4f1b67389d227ad05ab8c;p=thirdparty%2Flibcgroup.git 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 --- 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); } }