From patchwork Wed Jan 18 10:33:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 136582 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 942401007D2 for ; Wed, 18 Jan 2012 21:38:34 +1100 (EST) Received: from localhost ([::1]:36493 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnSqc-0003UG-0V for incoming@patchwork.ozlabs.org; Wed, 18 Jan 2012 05:34:30 -0500 Received: from eggs.gnu.org ([140.186.70.92]:33751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnSpv-00010N-Mm for qemu-devel@nongnu.org; Wed, 18 Jan 2012 05:33:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RnSpq-0006oT-4c for qemu-devel@nongnu.org; Wed, 18 Jan 2012 05:33:47 -0500 Received: from mail-iy0-f173.google.com ([209.85.210.173]:54353) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnSpp-0006jD-Uc for qemu-devel@nongnu.org; Wed, 18 Jan 2012 05:33:42 -0500 Received: by mail-iy0-f173.google.com with SMTP id o4so12460633iae.4 for ; Wed, 18 Jan 2012 02:33:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=MGTa68hUrKnZRWosXEBSiTchOBpt7oWUATd7KW7POS8=; b=EgJ2qhTZGcYldPzDZsLEMuLZYLzm6IQQOeJBupYNwhSpRyh43kK5mf3S5BuV7q6WDQ 4LMxouRNQO0yyCoyosUoLBQOxFbRB+j3RsaJlq7qYqrbfPM81O1PqIL40M6KpynwUUma 8NBvmDo2T0ijIJKg/dr4ll7+TnCdK6X+9h//g= Received: by 10.42.171.136 with SMTP id j8mr17808834icz.1.1326882821720; Wed, 18 Jan 2012 02:33:41 -0800 (PST) Received: from localhost.localdomain (93-34-200-238.ip51.fastwebnet.it. [93.34.200.238]) by mx.google.com with ESMTPS id b20sm87690976ibj.7.2012.01.18.02.33.39 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Jan 2012 02:33:40 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 18 Jan 2012 11:33:09 +0100 Message-Id: <1326882794-31816-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.7.1 In-Reply-To: <1326882794-31816-1-git-send-email-pbonzini@redhat.com> References: <1326882794-31816-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.173 Subject: [Qemu-devel] [RFC PATCH 4/9] rtc-test: fix set_alarm_time X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org GCC (correctly) reports uninitialized variables. Signed-off-by: Paolo Bonzini --- tests/rtc-test.c | 22 ++++------------------ 1 files changed, 4 insertions(+), 18 deletions(-) diff --git a/tests/rtc-test.c b/tests/rtc-test.c index 7f0b590..1645b34 100644 --- a/tests/rtc-test.c +++ b/tests/rtc-test.c @@ -195,26 +195,12 @@ static void dec_check_time(void) static void set_alarm_time(struct tm *tm) { - int sec, min, hour; - int hour_offset; - - sec = tm->tm_sec - 1; + int sec; + sec = tm->tm_sec; if ((cmos_read(RTC_REG_B) & REG_B_DM) == 0) { sec = dec2bcd(sec); - min = dec2bcd(min); - hour = dec2bcd(hour); - hour_offset = 80; - } else { - hour_offset = 0x80; - } - - if ((cmos_read(RTC_REG_B) & REG_B_24H) != 0) { - if (hour >= 12) { - hour -= 12; - hour += hour_offset; - } } cmos_write(RTC_SECONDS_ALARM, sec); @@ -236,11 +222,11 @@ static void alarm_time(void) g_assert(!get_irq(RTC_ISA_IRQ)); - now.tm_sec += 1; + now.tm_sec = (now.tm_sec + 2) % 60; set_alarm_time(&now); cmos_write(RTC_REG_B, cmos_read(RTC_REG_B) | REG_B_AIE); - for (i = 0; i < 1 + wiggle; i++) { + for (i = 0; i < 2 + wiggle; i++) { if (get_irq(RTC_ISA_IRQ)) { break; }