Commit 58d6db34 authored by Markus Elfring's avatar Markus Elfring Committed by Paolo Bonzini

KVM: Return an error code only as a constant in kvm_get_dirty_log_protect()

* Return an error code without storing it in an intermediate variable.

* Delete the local variable "r" and the jump label "out" which became
  unnecessary with this refactoring.
Signed-off-by: default avatarMarkus Elfring <>
Signed-off-by: default avatarPaolo Bonzini <>
parent f6a3b168
......@@ -1164,24 +1164,22 @@ int kvm_get_dirty_log_protect(struct kvm *kvm,
struct kvm_memslots *slots;
struct kvm_memory_slot *memslot;
int r, i, as_id, id;
int i, as_id, id;
unsigned long n;
unsigned long *dirty_bitmap;
unsigned long *dirty_bitmap_buffer;
r = -EINVAL;
as_id = log->slot >> 16;
id = (u16)log->slot;
goto out;
return -EINVAL;
slots = __kvm_memslots(kvm, as_id);
memslot = id_to_memslot(slots, id);
dirty_bitmap = memslot->dirty_bitmap;
r = -ENOENT;
if (!dirty_bitmap)
goto out;
return -ENOENT;
n = kvm_dirty_bitmap_bytes(memslot);
......@@ -1210,14 +1208,9 @@ int kvm_get_dirty_log_protect(struct kvm *kvm,
r = -EFAULT;
if (copy_to_user(log->dirty_bitmap, dirty_bitmap_buffer, n))
goto out;
r = 0;
return r;
return -EFAULT;
return 0;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment