diff --git a/include/exec/memory.h b/include/exec/memory.h index 2d9ea3c088..3e4d4164cd 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -467,12 +467,9 @@ void memory_region_init_rom(MemoryRegion *mr, * memory_region_init_rom_device: Initialize a ROM memory region. Writes are * handled via callbacks. * - * If NULL callbacks pointer is given, then I/O space is not supposed to be - * handled by QEMU itself. Any access via the memory API will cause an abort(). - * * @mr: the #MemoryRegion to be initialized. * @owner: the object that tracks the region's reference count - * @ops: callbacks for write access handling. + * @ops: callbacks for write access handling (must not be NULL). * @name: the name of the region. * @size: size of the region. * @errp: pointer to Error*, to store an error if it happens. diff --git a/memory.c b/memory.c index ecb565ea81..0eb6895fe6 100644 --- a/memory.c +++ b/memory.c @@ -1399,6 +1399,7 @@ void memory_region_init_rom_device(MemoryRegion *mr, uint64_t size, Error **errp) { + assert(ops); memory_region_init(mr, owner, name, size); mr->ops = ops; mr->opaque = opaque;