rockchip: atags: add atags existence verify before get

Change-Id: I939b1ff1a46c888fed928fe18f5298fdcb79215d
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
Joseph Chen 2018-10-09 14:58:01 +08:00 committed by Jianhong Chen
parent 6b9c0415e6
commit 1cd89291af
1 changed files with 4 additions and 1 deletions

View File

@ -201,6 +201,9 @@ struct tag *atags_get_tag(u32 magic)
{
struct tag *t;
if (!atags_is_available())
return NULL;
for_each_tag(t, (struct tag *)ATAGS_PHYS_BASE) {
if (bad_magic(t->hdr.magic)) {
#if !CONFIG_IS_ENABLED(TINY_FRAMEWORK)
@ -266,7 +269,7 @@ void atags_print_tag(struct tag *t)
printf(" version = 0x%x\n", t->u.serial.version);
printf(" enable = 0x%x\n", t->u.serial.enable);
printf(" addr = 0x%llx\n", t->u.serial.addr);
printf(" baudrate = 0x%x\n", t->u.serial.baudrate);
printf(" baudrate = %d\n", t->u.serial.baudrate);
printf(" m_mode = 0x%x\n", t->u.serial.m_mode);
for (i = 0; i < ARRAY_SIZE(t->u.serial.reserved); i++)
printf(" res[%d] = 0x%x\n", i, t->u.serial.reserved[i]);