summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrediano Ziglio2019-10-23 14:26:52 +0200
committerLaurent Vivier2019-10-24 20:10:18 +0200
commit5bd3435442104a73caba0167e57911e72b791500 (patch)
tree3cd5958fb67756ded7ea49c18b4fea59ae35af43
parentevent_notifier: avoid dandling file descriptor in event_notifier_cleanup (diff)
downloadqemu-5bd3435442104a73caba0167e57911e72b791500.tar.gz
qemu-5bd3435442104a73caba0167e57911e72b791500.tar.xz
qemu-5bd3435442104a73caba0167e57911e72b791500.zip
qemu-timer: reuse MIN macro in qemu_timeout_ns_to_ms
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20191023122652.2999-3-fziglio@redhat.com> [lv: removed the two useless casts] Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
-rw-r--r--util/qemu-timer.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/util/qemu-timer.c b/util/qemu-timer.c
index d428fec567..ef52d28d37 100644
--- a/util/qemu-timer.c
+++ b/util/qemu-timer.c
@@ -322,11 +322,7 @@ int qemu_timeout_ns_to_ms(int64_t ns)
ms = DIV_ROUND_UP(ns, SCALE_MS);
/* To avoid overflow problems, limit this to 2^31, i.e. approx 25 days */
- if (ms > (int64_t) INT32_MAX) {
- ms = INT32_MAX;
- }
-
- return (int) ms;
+ return MIN(ms, INT32_MAX);
}