On Wed, Aug 6, 2014 at 3:36 PM, Hu Tao <hu...@cn.fujitsu.com> wrote: > Add parameter errp to memory_region_init_rom_device and update all call > sites to pass in &error_abort. > > Signed-off-by: Hu Tao <hu...@cn.fujitsu.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwa...@xilinx.com> > --- > hw/block/pflash_cfi01.c | 2 +- > hw/block/pflash_cfi02.c | 2 +- > include/exec/memory.h | 4 +++- > memory.c | 5 +++-- > 4 files changed, 8 insertions(+), 5 deletions(-) > > diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c > index f9507b4..649565d 100644 > --- a/hw/block/pflash_cfi01.c > +++ b/hw/block/pflash_cfi01.c > @@ -770,7 +770,7 @@ static void pflash_cfi01_realize(DeviceState *dev, Error > **errp) > memory_region_init_rom_device( > &pfl->mem, OBJECT(dev), > pfl->be ? &pflash_cfi01_ops_be : &pflash_cfi01_ops_le, pfl, > - pfl->name, total_len); > + pfl->name, total_len, &error_abort); > vmstate_register_ram(&pfl->mem, DEVICE(pfl)); > pfl->storage = memory_region_get_ram_ptr(&pfl->mem); > sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->mem); > diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c > index 8d4b828..49db02d 100644 > --- a/hw/block/pflash_cfi02.c > +++ b/hw/block/pflash_cfi02.c > @@ -608,7 +608,7 @@ static void pflash_cfi02_realize(DeviceState *dev, Error > **errp) > > memory_region_init_rom_device(&pfl->orig_mem, OBJECT(pfl), pfl->be ? > &pflash_cfi02_ops_be : > &pflash_cfi02_ops_le, > - pfl, pfl->name, chip_len); > + pfl, pfl->name, chip_len, &error_abort); We probably should take the opportunity to error_propagate in these cases, to prepare support for hotplug of devs like this. But I think your blind conversions are a good first step as they will preserve existing behaviour. So lets call that follow up. Regards, Peter > vmstate_register_ram(&pfl->orig_mem, DEVICE(pfl)); > pfl->storage = memory_region_get_ram_ptr(&pfl->orig_mem); > pfl->chip_len = chip_len; > diff --git a/include/exec/memory.h b/include/exec/memory.h > index caa988d..71bed47 100644 > --- a/include/exec/memory.h > +++ b/include/exec/memory.h > @@ -388,13 +388,15 @@ void memory_region_init_alias(MemoryRegion *mr, > * @ops: callbacks for write access handling. > * @name: the name of the region. > * @size: size of the region. > + * @errp: pointer to Error*, to store an error if it happens. > */ > void memory_region_init_rom_device(MemoryRegion *mr, > struct Object *owner, > const MemoryRegionOps *ops, > void *opaque, > const char *name, > - uint64_t size); > + uint64_t size, > + Error **errp); > > /** > * memory_region_init_reservation: Initialize a memory region that reserves > diff --git a/memory.c b/memory.c > index bcebfd8..06a7e1b 100644 > --- a/memory.c > +++ b/memory.c > @@ -1223,7 +1223,8 @@ void memory_region_init_rom_device(MemoryRegion *mr, > const MemoryRegionOps *ops, > void *opaque, > const char *name, > - uint64_t size) > + uint64_t size, > + Error **errp) > { > memory_region_init(mr, owner, name, size); > mr->ops = ops; > @@ -1231,7 +1232,7 @@ void memory_region_init_rom_device(MemoryRegion *mr, > mr->terminates = true; > mr->rom_device = true; > mr->destructor = memory_region_destructor_rom_device; > - mr->ram_addr = qemu_ram_alloc(size, mr, &error_abort); > + mr->ram_addr = qemu_ram_alloc(size, mr, errp); > } > > void memory_region_init_iommu(MemoryRegion *mr, > -- > 1.9.3 > >