mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 15:31:22 +01:00
lib: utils/fdt: update fdt_parse_aplic_node()
1. Initialize struct imsic_data imsic to 0 at definition to prevent the use of uninitialized memory, ensuring the variable starts with known values. 2. Remove the redundant memset call on the "aplic" parameter since the memory for aplic is allocated using sbi_zalloc() by the caller irqchip_aplic_cold_init(), which guarantees it is already set to 0. Signed-off-by: Huang Borong <huangborong@bosc.ac.cn> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
@@ -630,14 +630,13 @@ int fdt_parse_aplic_node(const void *fdt, int nodeoff, struct aplic_data *aplic)
|
||||
bool child_found;
|
||||
const fdt32_t *val;
|
||||
const fdt32_t *del;
|
||||
struct imsic_data imsic;
|
||||
struct imsic_data imsic = { 0 };
|
||||
int i, j, d, dcnt, len, noff, rc;
|
||||
uint64_t reg_addr, reg_size;
|
||||
struct aplic_delegate_data *deleg;
|
||||
|
||||
if (nodeoff < 0 || !aplic || !fdt)
|
||||
return SBI_ENODEV;
|
||||
memset(aplic, 0, sizeof(*aplic));
|
||||
|
||||
rc = fdt_get_node_addr_size(fdt, nodeoff, 0, ®_addr, ®_size);
|
||||
if (rc < 0 || !reg_addr || !reg_size)
|
||||
|
Reference in New Issue
Block a user