cmd: pxe_utils: Fix checkpatch WARNING/CHECK

Fix checkpatch WARNING and CHECK issues

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
This commit is contained in:
Patrice Chotard 2019-11-25 09:07:39 +01:00 committed by Tom Rini
parent 993c912d30
commit 8cb22a66a7

View file

@ -78,7 +78,7 @@ static int get_bootfile_path(const char *file_path, char *bootfile_path,
last_slash = strrchr(bootfile, '/'); last_slash = strrchr(bootfile, '/');
if (last_slash == NULL ) if (!last_slash)
goto ret; goto ret;
path_len = (last_slash - bootfile) + 1; path_len = (last_slash - bootfile) + 1;
@ -125,9 +125,7 @@ static int get_relfile(cmd_tbl_t *cmdtp, const char *file_path,
path_len += strlen(relfile); path_len += strlen(relfile);
if (path_len > MAX_TFTP_PATH_LEN) { if (path_len > MAX_TFTP_PATH_LEN) {
printf("Base path too long (%s%s)\n", printf("Base path too long (%s%s)\n", relfile, file_path);
relfile,
file_path);
return -ENAMETOOLONG; return -ENAMETOOLONG;
} }
@ -182,7 +180,6 @@ int get_pxe_file(cmd_tbl_t *cmdtp, const char *file_path,
#define PXELINUX_DIR "pxelinux.cfg/" #define PXELINUX_DIR "pxelinux.cfg/"
/* /*
* Retrieves a file in the 'pxelinux.cfg' folder. Since this uses get_pxe_file * Retrieves a file in the 'pxelinux.cfg' folder. Since this uses get_pxe_file
* to do the hard work, the location of the 'pxelinux.cfg' folder is generated * to do the hard work, the location of the 'pxelinux.cfg' folder is generated
@ -214,7 +211,8 @@ int get_pxelinux_path(cmd_tbl_t *cmdtp, const char *file,
* *
* Returns 1 on success or < 0 on error. * Returns 1 on success or < 0 on error.
*/ */
static int get_relfile_envaddr(cmd_tbl_t *cmdtp, const char *file_path, const char *envaddr_name) static int get_relfile_envaddr(cmd_tbl_t *cmdtp, const char *file_path,
const char *envaddr_name)
{ {
unsigned long file_addr; unsigned long file_addr;
char *envaddr; char *envaddr;
@ -365,7 +363,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
return 0; return 0;
} }
if (label->kernel == NULL) { if (!label->kernel) {
printf("No kernel given, skipping %s\n", printf("No kernel given, skipping %s\n",
label->name); label->name);
return 1; return 1;
@ -400,6 +398,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
#ifdef CONFIG_CMD_NET #ifdef CONFIG_CMD_NET
if (label->ipappend & 0x2) { if (label->ipappend & 0x2) {
int err; int err;
strcpy(mac_str, " BOOTIF="); strcpy(mac_str, " BOOTIF=");
err = format_mac_pxe(mac_str + 8, sizeof(mac_str) - 8); err = format_mac_pxe(mac_str + 8, sizeof(mac_str) - 8);
if (err < 0) if (err < 0)
@ -418,10 +417,11 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
strlen(ip_str), strlen(mac_str), strlen(ip_str), strlen(mac_str),
sizeof(bootargs)); sizeof(bootargs));
return 1; return 1;
} else { }
if (label->append) if (label->append)
strncpy(bootargs, label->append, strncpy(bootargs, label->append, sizeof(bootargs));
sizeof(bootargs));
strcat(bootargs, ip_str); strcat(bootargs, ip_str);
strcat(bootargs, mac_str); strcat(bootargs, mac_str);
@ -429,7 +429,6 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
env_set("bootargs", finalbootargs); env_set("bootargs", finalbootargs);
printf("append: %s\n", finalbootargs); printf("append: %s\n", finalbootargs);
} }
}
bootm_argv[1] = env_get("kernel_addr_r"); bootm_argv[1] = env_get("kernel_addr_r");
/* for FIT, append the configuration identifier */ /* for FIT, append the configuration identifier */
@ -512,7 +511,9 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
} }
if (fdtfile) { if (fdtfile) {
int err = get_relfile_envaddr(cmdtp, fdtfile, "fdt_addr_r"); int err = get_relfile_envaddr(cmdtp, fdtfile,
"fdt_addr_r");
free(fdtfilefree); free(fdtfilefree);
if (err < 0) { if (err < 0) {
printf("Skipping %s for failure retrieving fdt\n", printf("Skipping %s for failure retrieving fdt\n",
@ -659,7 +660,8 @@ static char *get_string(char **p, struct token *t, char delim, int lower)
* e is incremented until we find the ending delimiter, or a NUL byte * e is incremented until we find the ending delimiter, or a NUL byte
* is reached. Then, we take e - b to find the length of the token. * is reached. Then, we take e - b to find the length of the token.
*/ */
b = e = *p; b = *p;
e = *p;
while (*e) { while (*e) {
if ((delim == ' ' && isspace(*e)) || delim == *e) if ((delim == ' ' && isspace(*e)) || delim == *e)
@ -841,8 +843,7 @@ static int handle_include(cmd_tbl_t *cmdtp, char **c, unsigned long base,
err = parse_sliteral(c, &include_path); err = parse_sliteral(c, &include_path);
if (err < 0) { if (err < 0) {
printf("Expected include path: %.*s\n", printf("Expected include path: %.*s\n", (int)(*c - s), s);
(int)(*c - s), s);
return err; return err;
} }
@ -886,8 +887,7 @@ static int parse_menu(cmd_tbl_t *cmdtp, char **c, struct pxe_menu *cfg,
break; break;
case T_INCLUDE: case T_INCLUDE:
err = handle_include(cmdtp, c, base, cfg, err = handle_include(cmdtp, c, base, cfg, nest_level + 1);
nest_level + 1);
break; break;
case T_BACKGROUND: case T_BACKGROUND:
@ -1252,7 +1252,6 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)
if (cfg->default_label && if (cfg->default_label &&
(strcmp(label->name, cfg->default_label) == 0)) (strcmp(label->name, cfg->default_label) == 0))
default_num = label->num; default_num = label->num;
} }
/* /*