mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-06-15 18:05:49 +00:00
kvm__emulate_io: Don't call br_read_unlock() twice on IO error
The IO error path in kvm__emulate_io would call br_read_unlock(), then goto error, which would call br_read_unlock() again. Refactor the control flow to have only one exit path and one call to br_read_unlock(). Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Will Deacon <will.deacon@arm.com>
This commit is contained in:
committed by
Will Deacon
parent
eef27ae368
commit
e7b95bd430
@@ -185,7 +185,7 @@ bool kvm__emulate_io(struct kvm_cpu *vcpu, u16 port, void *data, int direction,
|
||||
br_read_lock();
|
||||
entry = ioport_search(&ioport_tree, port);
|
||||
if (!entry)
|
||||
goto error;
|
||||
goto out;
|
||||
|
||||
ops = entry->ops;
|
||||
|
||||
@@ -198,14 +198,11 @@ bool kvm__emulate_io(struct kvm_cpu *vcpu, u16 port, void *data, int direction,
|
||||
ptr += size;
|
||||
}
|
||||
|
||||
out:
|
||||
br_read_unlock();
|
||||
|
||||
if (!ret)
|
||||
goto error;
|
||||
|
||||
return true;
|
||||
error:
|
||||
br_read_unlock();
|
||||
if (ret)
|
||||
return true;
|
||||
|
||||
if (kvm->cfg.ioport_debug)
|
||||
ioport_error(port, data, direction, size, count);
|
||||
|
||||
Reference in New Issue
Block a user