提交 bc53fb19 编写于 作者: S Stefan Agner 提交者: Stefano Babic

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: NStefan Agner <stefan.agner@toradex.com>
上级 57b62025
......@@ -156,10 +156,13 @@ out:
static int read_tdx_cfg_block_from_nand(unsigned char *config_block)
{
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 */
return nand_read_skip_bad(get_nand_dev_by_index(0),
CONFIG_TDX_CFG_BLOCK_OFFSET,
return nand_read_skip_bad(mtd, CONFIG_TDX_CFG_BLOCK_OFFSET,
&size, NULL, TDX_CFG_BLOCK_MAX_SIZE,
config_block);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册