exec.c: subpage->sub_section is already initialized to 0
In subpage_init(), we will set subpage->sub_section to PHYS_SECTION_UNASSIGNED by subpage_register. Since PHYS_SECTION_UNASSIGNED is defined to be 0, and we allocate subpage with g_malloc0, this means subpage->sub_section is already initialized to 0. This patch removes the redundant setup for a new subpage and also fix the code style. Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> Message-Id: <20190321082555.21118-5-richardw.yang@linux.intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
c95cfd0400
commit
b797ab1a15
2
exec.c
2
exec.c
@ -2937,6 +2937,7 @@ static subpage_t *subpage_init(FlatView *fv, hwaddr base)
|
|||||||
{
|
{
|
||||||
subpage_t *mmio;
|
subpage_t *mmio;
|
||||||
|
|
||||||
|
/* mmio->sub_section is set to PHYS_SECTION_UNASSIGNED with g_malloc0 */
|
||||||
mmio = g_malloc0(sizeof(subpage_t) + TARGET_PAGE_SIZE * sizeof(uint16_t));
|
mmio = g_malloc0(sizeof(subpage_t) + TARGET_PAGE_SIZE * sizeof(uint16_t));
|
||||||
mmio->fv = fv;
|
mmio->fv = fv;
|
||||||
mmio->base = base;
|
mmio->base = base;
|
||||||
@ -2947,7 +2948,6 @@ static subpage_t *subpage_init(FlatView *fv, hwaddr base)
|
|||||||
printf("%s: %p base " TARGET_FMT_plx " len %08x\n", __func__,
|
printf("%s: %p base " TARGET_FMT_plx " len %08x\n", __func__,
|
||||||
mmio, base, TARGET_PAGE_SIZE);
|
mmio, base, TARGET_PAGE_SIZE);
|
||||||
#endif
|
#endif
|
||||||
subpage_register(mmio, 0, TARGET_PAGE_SIZE-1, PHYS_SECTION_UNASSIGNED);
|
|
||||||
|
|
||||||
return mmio;
|
return mmio;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user