hw/arm/raspi4b: remove redundant check in raspi_add_memory_node
The if (acells == 0 || scells == 0) check is redundant in raspi_add_memory_node, since it is already checked in the call chain, arm_load_dtb. Also the return value of the function is not checked/used so it's removed. Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 20250902200818.43305-1-osama.abdelkader@gmail.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
2b5daf79c3
commit
cc2c5027dc
1 changed files with 9 additions and 13 deletions
|
|
@ -36,9 +36,8 @@ struct Raspi4bMachineState {
|
|||
* (see https://datasheets.raspberrypi.com/bcm2711/bcm2711-peripherals.pdf
|
||||
* 1.2 Address Map)
|
||||
*/
|
||||
static int raspi_add_memory_node(void *fdt, hwaddr mem_base, hwaddr mem_len)
|
||||
static void raspi_add_memory_node(void *fdt, hwaddr mem_base, hwaddr mem_len)
|
||||
{
|
||||
int ret;
|
||||
uint32_t acells, scells;
|
||||
char *nodename = g_strdup_printf("/memory@%" PRIx64, mem_base);
|
||||
|
||||
|
|
@ -46,19 +45,16 @@ static int raspi_add_memory_node(void *fdt, hwaddr mem_base, hwaddr mem_len)
|
|||
NULL, &error_fatal);
|
||||
scells = qemu_fdt_getprop_cell(fdt, "/", "#size-cells",
|
||||
NULL, &error_fatal);
|
||||
if (acells == 0 || scells == 0) {
|
||||
fprintf(stderr, "dtb file invalid (#address-cells or #size-cells 0)\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
qemu_fdt_add_subnode(fdt, nodename);
|
||||
qemu_fdt_setprop_string(fdt, nodename, "device_type", "memory");
|
||||
ret = qemu_fdt_setprop_sized_cells(fdt, nodename, "reg",
|
||||
acells, mem_base,
|
||||
scells, mem_len);
|
||||
}
|
||||
/* validated by arm_load_dtb */
|
||||
g_assert(acells && scells);
|
||||
|
||||
qemu_fdt_add_subnode(fdt, nodename);
|
||||
qemu_fdt_setprop_string(fdt, nodename, "device_type", "memory");
|
||||
qemu_fdt_setprop_sized_cells(fdt, nodename, "reg",
|
||||
acells, mem_base,
|
||||
scells, mem_len);
|
||||
|
||||
g_free(nodename);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void raspi4_modify_dtb(const struct arm_boot_info *info, void *fdt)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue