From 5bd3435442104a73caba0167e57911e72b791500 Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Wed, 23 Oct 2019 13:26:52 +0100 Subject: qemu-timer: reuse MIN macro in qemu_timeout_ns_to_ms Signed-off-by: Frediano Ziglio Reviewed-by: Laurent Vivier Message-Id: <20191023122652.2999-3-fziglio@redhat.com> [lv: removed the two useless casts] Reviewed-by: Eric Blake Signed-off-by: Laurent Vivier --- util/qemu-timer.c | 6 +----- 1 file changed, 1 insertion(+), 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); } -- cgit v1.2.3-55-g7522