From: Kamalesh Babulal Date: Wed, 9 Mar 2022 06:54:27 +0000 (+0530) Subject: src/abstraction-common.c: fix checkpatch.pl warnings X-Git-Tag: v3.0~189 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=330ed8cc8abce203c61754caa197f6d7cc22b7e2;p=thirdparty%2Flibcgroup.git src/abstraction-common.c: fix checkpatch.pl warnings 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 Signed-off-by: Tom Hromatka --- diff --git a/src/abstraction-common.c b/src/abstraction-common.c index f8630ddb..2cccf49e 100644 --- a/src/abstraction-common.c +++ b/src/abstraction-common.c @@ -19,20 +19,21 @@ * along with this library; if not, see . */ +#include "abstraction-common.h" +#include "abstraction-map.h" + #include #include -#include -#include #include #include #include +#include +#include -#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) /*