diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-08-11 23:42:26 -0400 |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2010-08-13 13:32:42 -0500 |
commit | 962ad59e25640e586e2bceabf67a628a27f8f508 (patch) | |
tree | 232b659a46815bf280fa284a1fa513c0b7246102 /common/env_nand.c | |
parent | 668a6b45915d10d75357f5b93f569bbf49ea2b06 (diff) | |
download | bootable_bootloader_goldelico_gta04-962ad59e25640e586e2bceabf67a628a27f8f508.zip bootable_bootloader_goldelico_gta04-962ad59e25640e586e2bceabf67a628a27f8f508.tar.gz bootable_bootloader_goldelico_gta04-962ad59e25640e586e2bceabf67a628a27f8f508.tar.bz2 |
env_nand: return error when no device is found
Currently, if there is an error probing the NAND chip and the env is based
in NAND, the readenv() function will use a NULL function pointer and thus
jump to address 0.
Here I just check for a non-zero value of blocksize as that shouldn't be
zero when a valid device is found, but perhaps there is a better way for
someone familiar with the NAND internals to suggest.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Tested-by: Ben Gardiner <bengardiner@nanometrics.ca>
Diffstat (limited to 'common/env_nand.c')
-rw-r--r-- | common/env_nand.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/common/env_nand.c b/common/env_nand.c index a5e1038..d38bcca 100644 --- a/common/env_nand.c +++ b/common/env_nand.c @@ -266,6 +266,8 @@ int readenv (size_t offset, u_char * buf) u_char *char_ptr; blocksize = nand_info[0].erasesize; + if (!blocksize) + return 1; len = min(blocksize, CONFIG_ENV_SIZE); while (amount_loaded < CONFIG_ENV_SIZE && offset < end) { |