Move call to memory_region_dispatch_write() outside of swtich statement since the only thing that is different about all of those call is "length" argument and that matches value in "l". Reviewed-by: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx> --- exec.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/exec.c b/exec.c index 44cd424..e2425c5 100644 --- a/exec.c +++ b/exec.c @@ -2567,32 +2567,23 @@ static MemTxResult address_space_write_continue(AddressSpace *as, hwaddr addr, potential bugs */ switch (l) { case 8: - /* 64 bit write access */ - val = ldq_p(buf); - result |= memory_region_dispatch_write(mr, addr1, val, 8, - attrs); + val = ldq_p(buf); /* 64 bit write access */ break; case 4: - /* 32 bit write access */ - val = ldl_p(buf); - result |= memory_region_dispatch_write(mr, addr1, val, 4, - attrs); + val = ldl_p(buf); /* 32 bit write access */ break; case 2: - /* 16 bit write access */ - val = lduw_p(buf); - result |= memory_region_dispatch_write(mr, addr1, val, 2, - attrs); + val = lduw_p(buf); /* 16 bit write access */ break; case 1: - /* 8 bit write access */ - val = ldub_p(buf); - result |= memory_region_dispatch_write(mr, addr1, val, 1, - attrs); + val = ldub_p(buf); /* 8 bit write access */ break; default: abort(); } + + result |= memory_region_dispatch_write(mr, addr1, val, l, + attrs); } else { /* RAM case */ ptr = qemu_map_ram_ptr(mr->ram_block, addr1); -- 2.5.5 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html