Skip to content

Commit 7016244

Browse files
shiqinggwenlingz
authored andcommitted
hv: io: fix MISRA-C violations related to break
This patch fixes the MISRA-C violations in arch/x86/io.c * make the for loop have only one `break` Tracked-On: #861 Signed-off-by: Shiqing Gao <shiqing.gao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 68643b6 commit 7016244

File tree

1 file changed

+7
-2
lines changed
  • hypervisor/arch/x86

1 file changed

+7
-2
lines changed

hypervisor/arch/x86/io.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ hv_emulate_mmio(struct acrn_vcpu *vcpu, struct io_request *io_req)
247247

248248
for (idx = 0U; idx < vcpu->vm->emul_mmio_regions; idx++) {
249249
uint64_t base, end;
250+
bool emulation_done = false;
250251

251252
mmio_handler = &(vcpu->vm->emul_mmio[idx]);
252253
base = mmio_handler->range_start;
@@ -257,14 +258,18 @@ hv_emulate_mmio(struct acrn_vcpu *vcpu, struct io_request *io_req)
257258
} else if (!((address >= base) && ((address + size) <= end))) {
258259
pr_fatal("Err MMIO, address:0x%llx, size:%x", address, size);
259260
status = -EIO;
260-
break;
261+
emulation_done = true;
261262
} else {
262263
/* Handle this MMIO operation */
263264
if (mmio_handler->read_write != NULL) {
264265
status = mmio_handler->read_write(io_req, mmio_handler->handler_private_data);
265-
break;
266+
emulation_done = true;
266267
}
267268
}
269+
270+
if (emulation_done) {
271+
break;
272+
}
268273
}
269274

270275
return status;

0 commit comments

Comments
 (0)