You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
firmware: rockchip_sip: add valid value check for map->bank_bit_first
Change-Id: I4909cd313854a10c415686f3c9df85411677370d Signed-off-by: YouMin Chen <cym@rock-chips.com>
This commit is contained in:
@@ -211,28 +211,29 @@ struct dram_addrmap_info *sip_smc_get_dram_map(void)
|
||||
{
|
||||
struct arm_smccc_res res;
|
||||
static struct dram_addrmap_info *map;
|
||||
struct dram_addrmap_info *m;
|
||||
|
||||
if (map)
|
||||
return map;
|
||||
return map->bank_bit_first ? map : NULL;
|
||||
|
||||
/* Request share memory size 4KB */
|
||||
res = sip_smc_request_share_mem(1, SHARE_PAGE_TYPE_DDR_ADDRMAP);
|
||||
if (res.a0 != 0) {
|
||||
pr_err("no ATF memory for init\n");
|
||||
pr_err("%s: request share memory error!\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
map = (struct dram_addrmap_info *)res.a1;
|
||||
m = (struct dram_addrmap_info *)res.a1;
|
||||
memset(m, 0x0, sizeof(*m));
|
||||
|
||||
res = sip_smc_dram(SHARE_PAGE_TYPE_DDR_ADDRMAP, 0,
|
||||
ROCKCHIP_SIP_CONFIG_DRAM_ADDRMAP_GET);
|
||||
if (res.a0) {
|
||||
pr_err("rockchip_sip_config_dram_init error:%lx\n", res.a0);
|
||||
map = NULL;
|
||||
pr_err("rockchip_sip_config_dram_addrmap_get error:%lx\n", res.a0);
|
||||
return NULL;
|
||||
}
|
||||
map = m;
|
||||
|
||||
return map;
|
||||
return map->bank_bit_first ? map : NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sip_smc_get_dram_map);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user