On 5/24/20 1:20 AM, Peter Xu wrote: > kvm_vm_ioctl() handles the errno trick already for ioctl() on > returning -1 for errors. Fix this. > > Reviewed-by: Dr. David Alan Gilbert <dgilb...@redhat.com> > Signed-off-by: Peter Xu <pet...@redhat.com> > --- > accel/kvm/kvm-all.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c > index d06cc04079..6e015aa2d4 100644 > --- a/accel/kvm/kvm-all.c > +++ b/accel/kvm/kvm-all.c > @@ -699,14 +699,13 @@ static int kvm_log_clear_one_slot(KVMSlot *mem, int > as_id, uint64_t start, > d.num_pages = bmap_npages; > d.slot = mem->slot | (as_id << 16); > > - if (kvm_vm_ioctl(s, KVM_CLEAR_DIRTY_LOG, &d) == -1) { > - ret = -errno; > + ret = kvm_vm_ioctl(s, KVM_CLEAR_DIRTY_LOG, &d); > + if (ret) { > error_report("%s: KVM_CLEAR_DIRTY_LOG failed, slot=%d, " > "start=0x%"PRIx64", size=0x%"PRIx32", errno=%d", > __func__, d.slot, (uint64_t)d.first_page, > (uint32_t)d.num_pages, ret); > } else { > - ret = 0; > trace_kvm_clear_dirty_log(d.slot, d.first_page, d.num_pages); > } > >
Reviewed-by: Philippe Mathieu-Daudé <phi...@redhat.com>