From c5cbbe35fd7b3d05273f4d3f273c9e613bd38d7d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Beh=C3=BAn?= Date: Fri, 22 Oct 2021 15:47:24 +0200 Subject: [PATCH] env: Always use char for default_environment MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Sometimes we use uchar and sometimes char for the default environment array. By always using char, we can get rid of some explicit casts. Signed-off-by: Marek Behún Reviewed-by: Simon Glass --- board/Marvell/mvebu_armada-37xx/board.c | 2 +- env/common.c | 6 +++--- include/env_default.h | 4 ++-- include/env_internal.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c index 2de9c2ac17..d7b6ecafbf 100644 --- a/board/Marvell/mvebu_armada-37xx/board.c +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -87,7 +87,7 @@ int board_init(void) #ifdef CONFIG_BOARD_LATE_INIT int board_late_init(void) { - char *ptr = (char *)&default_environment[0]; + char *ptr = &default_environment[0]; struct udevice *dev; struct mmc *mmc_dev; bool ddr4, emmc; diff --git a/env/common.c b/env/common.c index db213b7748..664d2e688e 100644 --- a/env/common.c +++ b/env/common.c @@ -162,7 +162,7 @@ int env_get_f(const char *name, char *buf, unsigned len) name_len = strlen(name); if (gd->env_valid == ENV_INVALID) - env = (const char *)default_environment; + env = default_environment; else env = (const char *)gd->env_addr; @@ -264,7 +264,7 @@ void env_set_default(const char *s, int flags) } flags |= H_DEFAULT; - if (himport_r(&env_htab, (char *)default_environment, + if (himport_r(&env_htab, default_environment, sizeof(default_environment), '\0', flags, 0, 0, NULL) == 0) pr_err("## Error: Environment import failed: errno = %d\n", @@ -283,7 +283,7 @@ int env_set_default_vars(int nvars, char * const vars[], int flags) * (and use \0 as a separator) */ flags |= H_NOCLEAR | H_DEFAULT; - return himport_r(&env_htab, (const char *)default_environment, + return himport_r(&env_htab, default_environment, sizeof(default_environment), '\0', flags, 0, nvars, vars); } diff --git a/include/env_default.h b/include/env_default.h index 66e203eb6e..a6724719ec 100644 --- a/include/env_default.h +++ b/include/env_default.h @@ -20,9 +20,9 @@ env_t embedded_environment __UBOOT_ENV_SECTION__(environment) = { #elif defined(DEFAULT_ENV_INSTANCE_STATIC) static char default_environment[] = { #elif defined(DEFAULT_ENV_IS_RW) -uchar default_environment[] = { +char default_environment[] = { #else -const uchar default_environment[] = { +const char default_environment[] = { #endif #ifndef CONFIG_USE_DEFAULT_ENV_FILE #ifdef CONFIG_ENV_CALLBACK_LIST_DEFAULT diff --git a/include/env_internal.h b/include/env_internal.h index b7bddcb00d..f74927cd64 100644 --- a/include/env_internal.h +++ b/include/env_internal.h @@ -112,9 +112,9 @@ extern env_t embedded_environment; #endif /* ENV_IS_EMBEDDED */ #ifdef DEFAULT_ENV_IS_RW -extern unsigned char default_environment[]; +extern char default_environment[]; #else -extern const unsigned char default_environment[]; +extern const char default_environment[]; #endif #ifndef DO_DEPS_ONLY -- 2.39.5