mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-11 07:34:31 +00:00
board: toradex: common: fail gracefully on missing NAND chip
If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail gracefully in this case. Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
This commit is contained in:
parent
57b620255e
commit
bc53fb19fe
1 changed files with 5 additions and 2 deletions
|
@ -156,10 +156,13 @@ out:
|
||||||
static int read_tdx_cfg_block_from_nand(unsigned char *config_block)
|
static int read_tdx_cfg_block_from_nand(unsigned char *config_block)
|
||||||
{
|
{
|
||||||
size_t size = TDX_CFG_BLOCK_MAX_SIZE;
|
size_t size = TDX_CFG_BLOCK_MAX_SIZE;
|
||||||
|
struct mtd_info *mtd = get_nand_dev_by_index(0);
|
||||||
|
|
||||||
|
if (!mtd)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
/* Read production parameter config block from NAND page */
|
/* Read production parameter config block from NAND page */
|
||||||
return nand_read_skip_bad(get_nand_dev_by_index(0),
|
return nand_read_skip_bad(mtd, CONFIG_TDX_CFG_BLOCK_OFFSET,
|
||||||
CONFIG_TDX_CFG_BLOCK_OFFSET,
|
|
||||||
&size, NULL, TDX_CFG_BLOCK_MAX_SIZE,
|
&size, NULL, TDX_CFG_BLOCK_MAX_SIZE,
|
||||||
config_block);
|
config_block);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue