This assert is checking the ops parameter so better placed in the
function that sets the ops.

Signed-off-by: BALATON Zoltan <[email protected]>
---
 system/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/system/memory.c b/system/memory.c
index 739ba11da6..9abdaedce0 100644
--- a/system/memory.c
+++ b/system/memory.c
@@ -1564,6 +1564,7 @@ static void memory_region_set_ops(MemoryRegion *mr,
                                   const MemoryRegionOps *ops,
                                   void *opaque)
 {
+    g_assert(!ops || !(ops->impl.unaligned && !ops->valid.unaligned));
     mr->ops = ops ?: &unassigned_mem_ops;
     mr->opaque = opaque;
     mr->terminates = true;
@@ -1573,7 +1574,6 @@ void memory_region_init_io(MemoryRegion *mr, Object 
*owner,
                            const MemoryRegionOps *ops, void *opaque,
                            const char *name, uint64_t size)
 {
-    g_assert(!ops || !(ops->impl.unaligned && !ops->valid.unaligned));
     memory_region_init(mr, owner, name, size);
     memory_region_set_ops(mr, ops, opaque);
 }
-- 
2.41.3


Reply via email to