From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [RFC PATCH 4/9] rtc-test: fix set_alarm_time
Date: Wed, 18 Jan 2012 11:33:09 +0100 [thread overview]
Message-ID: <1326882794-31816-5-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1326882794-31816-1-git-send-email-pbonzini@redhat.com>
GCC (correctly) reports uninitialized variables.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
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;
}
--
1.7.7.1
next prev parent reply other threads:[~2012-01-18 10:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-18 10:33 [Qemu-devel] [RFC PATCH 0/9] qtest fixes and alternative IRQ intercept proposal Paolo Bonzini
2012-01-18 10:33 ` [Qemu-devel] [RFC PATCH 1/9] qtest: always send a response Paolo Bonzini
2012-01-18 10:33 ` [Qemu-devel] [RFC PATCH 2/9] qtest: enable echo Paolo Bonzini
2012-01-18 10:33 ` [Qemu-devel] [RFC PATCH 3/9] qtest: fix Makefile Paolo Bonzini
2012-01-18 10:33 ` Paolo Bonzini [this message]
2012-01-18 10:33 ` [Qemu-devel] [RFC PATCH 5/9] qtest: do not use TCG CPU threads Paolo Bonzini
2012-01-18 10:53 ` Andreas Färber
2012-01-18 11:14 ` Paolo Bonzini
2012-01-18 10:33 ` [Qemu-devel] [RFC PATCH 6/9] pc: attach ioapic to the QOM composition tree Paolo Bonzini
2012-01-24 15:12 ` Jan Kiszka
2012-01-18 10:33 ` [Qemu-devel] [RFC PATCH 7/9] qtest: IRQ interception infrastructure Paolo Bonzini
2012-01-18 10:33 ` [Qemu-devel] [RFC PATCH 8/9] libqtest: add IRQ intercept commands Paolo Bonzini
2012-01-18 10:33 ` [Qemu-devel] [RFC PATCH 9/9] rtc-test: add IRQ intercept Paolo Bonzini
2012-01-18 14:31 ` [Qemu-devel] [RFC PATCH 10/9] qtest: add clock management Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1326882794-31816-5-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).