From patchwork Mon Dec 21 08:09:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 41522 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 57B3EB6F0E for ; Mon, 21 Dec 2009 19:42:00 +1100 (EST) Received: from localhost ([127.0.0.1]:42055 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMdls-0002mY-1L for incoming@patchwork.ozlabs.org; Mon, 21 Dec 2009 03:37:40 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NMdKp-0002iP-EU for qemu-devel@nongnu.org; Mon, 21 Dec 2009 03:09:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NMdKj-0002gM-MC for qemu-devel@nongnu.org; Mon, 21 Dec 2009 03:09:42 -0500 Received: from [199.232.76.173] (port=52811 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMdKi-0002g2-ER for qemu-devel@nongnu.org; Mon, 21 Dec 2009 03:09:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49649) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NMdKh-0003nc-Uc for qemu-devel@nongnu.org; Mon, 21 Dec 2009 03:09:36 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBL89ZOS020483 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 21 Dec 2009 03:09:35 -0500 Received: from localhost.localdomain (vpn2-10-119.ams2.redhat.com [10.36.10.119]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBL89V3N011460 for ; Mon, 21 Dec 2009 03:09:34 -0500 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 21 Dec 2009 09:09:14 +0100 Message-Id: <1261382970-23251-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1261382970-23251-1-git-send-email-pbonzini@redhat.com> References: <1261382970-23251-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 03/19] avoid dubiously clever code in win32_start_timer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The code is initializing an unsigned int to UINT_MAX using "-1", so that the following always-true comparison seems to be always-false at a first look. Just remove the if. Signed-off-by: Paolo Bonzini --- vl.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/vl.c b/vl.c index 97410ad..22ec53d 100644 --- a/vl.c +++ b/vl.c @@ -813,7 +813,7 @@ static struct qemu_alarm_timer *alarm_timer; struct qemu_alarm_win32 { MMRESULT timerId; unsigned int period; -} alarm_win32_data = {0, -1}; +} alarm_win32_data = {0, 0}; static int win32_start_timer(struct qemu_alarm_timer *t); static void win32_stop_timer(struct qemu_alarm_timer *t); @@ -1550,9 +1550,7 @@ static int win32_start_timer(struct qemu_alarm_timer *t) memset(&tc, 0, sizeof(tc)); timeGetDevCaps(&tc, sizeof(tc)); - if (data->period < tc.wPeriodMin) - data->period = tc.wPeriodMin; - + data->period = tc.wPeriodMin; timeBeginPeriod(data->period); flags = TIME_CALLBACK_FUNCTION;