]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
src/abstraction-common.c: fix checkpatch.pl warnings
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 9 Mar 2022 06:54:27 +0000 (12:24 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 11 Mar 2022 14:46:21 +0000 (07:46 -0700)
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO types.  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, 7 warnings, 320 lines checked

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/abstraction-common.c

index f8630ddbef0c16066373684b53b91dd63ec5a262..2cccf49e909d27b53a27727c6734de38196e0c39 100644 (file)
  * along with this library; if not, see <http://www.gnu.org/licenses>.
  */
 
+#include "abstraction-common.h"
+#include "abstraction-map.h"
+
 #include <libcgroup.h>
 #include <libcgroup-internal.h>
 
-#include <errno.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <errno.h>
+#include <stdio.h>
 
-#include "abstraction-common.h"
-#include "abstraction-map.h"
 
 int cgroup_strtol(const char * const in_str, int base,
-                 long int * const out_value)
+                 long * const out_value)
 {
        char *endptr = NULL;
        int ret = 0;
@@ -74,10 +75,10 @@ int cgroup_convert_int(struct cgroup_controller * const dst_cgc,
 {
 #define OUT_VALUE_STR_LEN 20
 
-       long int in_dflt_int = (long int)in_dflt;
-       long int out_dflt_int = (long int)out_dflt;
+       long out_dflt_int = (long)out_dflt;
+       long in_dflt_int = (long)in_dflt;
        char *out_value_str = NULL;
-       long int out_value;
+       long out_value;
        int ret;
 
        if (!in_value)
@@ -144,8 +145,8 @@ static int convert_setting(struct cgroup_controller * const out_cgc,
                           const struct control_value * const in_ctrl_val)
 {
        const struct cgroup_abstraction_map *convert_tbl;
-       int tbl_sz = 0;
        int ret = ECGINVAL;
+       int tbl_sz = 0;
        int i;
 
        switch (out_cgc->version) {
@@ -266,9 +267,8 @@ int cgroup_convert_cgroup(struct cgroup * const out_cgroup,
                }
 
                /* the user has overridden the version */
-               if (in_version == CGROUP_V1 || in_version == CGROUP_V2) {
+               if (in_version == CGROUP_V1 || in_version == CGROUP_V2)
                        in_cgroup->controller[i]->version = in_version;
-               }
 
                if (strcmp(CGROUP_FILE_PREFIX, cgc->name) == 0)
                        /*