mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 06:31:31 +00:00
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>
This commit is contained in:
parent
668a6b4591
commit
962ad59e25
1 changed files with 2 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue