if (crc32(0, ep->data, ENV_SIZE) != crc) {
set_default_env("!bad CRC");
- return 0;
+ return -EIO;
}
}
if (himport_r(&env_htab, (char *)ep->data, ENV_SIZE, '\0', 0, 0,
0, NULL)) {
gd->flags |= GD_FLG_ENV_READY;
- return 1;
+ return 0;
}
pr_err("Cannot import environment: errno = %d\n", errno);
set_default_env("!import failed");
- return 0;
+ return -EIO;
}
#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
if (!crc1_ok && !crc2_ok) {
set_default_env("!bad CRC");
- return 0;
+ return -EIO;
} else if (crc1_ok && !crc2_ok) {
gd->env_valid = ENV_VALID;
} else if (!crc1_ok && crc2_ok) {
#endif /* !ENV_IS_EMBEDDED */
rc = env_import(buf, 1);
- if (rc)
+ if (!rc)
gd->env_valid = ENV_VALID;
- return rc ? 0 : -EIO;
+ return rc;
}
static int env_onenand_save(void)
ep = tmp_env2;
ret = env_import((char *)ep, 0);
- if (!ret) {
+ if (ret) {
pr_err("Cannot import environment: errno = %d\n", errno);
set_default_env("!env_import failed");
}
}
ret = env_import(buf, 1);
- if (ret)
+ if (!ret)
gd->env_valid = ENV_VALID;
err_read: