aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/kvm/i8254.c
diff options
context:
space:
mode:
authorDmitry Voronetskiy <vda1999@yandex.ru>2021-05-19 14:35:28 +0300
committerLaurent Vivier <laurent@vivier.eu>2021-06-05 21:01:17 +0200
commitd84451d38e9a36ff08af9b1424ecca51ba45e3ac (patch)
tree84f585e411a8ace001b7f454e1ec1a1aeab2d96a /hw/i386/kvm/i8254.c
parent0d42cd5c1d370701c9f17367115244fbaedd2ea1 (diff)
i386/kvm: The value passed to strerror should be positive
Signed-off-by: Dmitry Voronetskiy <vda1999@yandex.ru> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210519113528.12474-1-davoronetskiy@gmail.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'hw/i386/kvm/i8254.c')
-rw-r--r--hw/i386/kvm/i8254.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c
index c558893961..fa68669e8a 100644
--- a/hw/i386/kvm/i8254.c
+++ b/hw/i386/kvm/i8254.c
@@ -104,7 +104,7 @@ static void kvm_pit_get(PITCommonState *pit)
if (kvm_has_pit_state2()) {
ret = kvm_vm_ioctl(kvm_state, KVM_GET_PIT2, &kpit);
if (ret < 0) {
- fprintf(stderr, "KVM_GET_PIT2 failed: %s\n", strerror(ret));
+ fprintf(stderr, "KVM_GET_PIT2 failed: %s\n", strerror(-ret));
abort();
}
pit->channels[0].irq_disabled = kpit.flags & KVM_PIT_FLAGS_HPET_LEGACY;
@@ -115,7 +115,7 @@ static void kvm_pit_get(PITCommonState *pit)
*/
ret = kvm_vm_ioctl(kvm_state, KVM_GET_PIT, &kpit);
if (ret < 0) {
- fprintf(stderr, "KVM_GET_PIT failed: %s\n", strerror(ret));
+ fprintf(stderr, "KVM_GET_PIT failed: %s\n", strerror(-ret));
abort();
}
}
@@ -180,7 +180,7 @@ static void kvm_pit_put(PITCommonState *pit)
if (ret < 0) {
fprintf(stderr, "%s failed: %s\n",
kvm_has_pit_state2() ? "KVM_SET_PIT2" : "KVM_SET_PIT",
- strerror(ret));
+ strerror(-ret));
abort();
}
}
@@ -272,7 +272,7 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp)
}
if (ret < 0) {
error_setg(errp, "Create kernel PIC irqchip failed: %s",
- strerror(ret));
+ strerror(-ret));
return;
}
switch (s->lost_tick_policy) {
@@ -286,7 +286,7 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp)
if (ret < 0) {
error_setg(errp,
"Can't disable in-kernel PIT reinjection: %s",
- strerror(ret));
+ strerror(-ret));
return;
}
}