]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
samples/get_controller.c: fix checkpatch.pl warnings
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 16 Mar 2022 15:55:22 +0000 (21:25 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 16 Mar 2022 21:38:20 +0000 (15:38 -0600)
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 <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
samples/c/get_controller.c

index 3c1421b75dc4e253dbc921964d4295cf97df0fc6..6115bc971948f638939df970c820a8ea163b6004 100644 (file)
@@ -1,30 +1,29 @@
 // SPDX-License-Identifier: LGPL-2.1-only
 #include <libcgroup.h>
-#include <stdio.h>
+
 #include <stdlib.h>
+#include <stdio.h>
 
-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);
                }
        }