env: Always use char for default_environment

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 <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Marek Behún 2021-10-22 15:47:24 +02:00 committed by Simon Glass
parent b26334824b
commit c5cbbe35fd
4 changed files with 8 additions and 8 deletions

View File

@ -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;

6
env/common.c vendored
View File

@ -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);
}

View File

@ -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

View File

@ -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