Skip to contentSkip to conversation

ds1338: Add missing break statement

PATCH Applied Stefan Weil 4 participants 5 messages Feb 25, 2012 – Mar 15, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ds1338: Add missing break statement

Without the break statement, case 5 sets month and year from the same data. This does not look correct.

The missing break was reported by splint.

---
 hw/ds1338.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
hw/ds1338.c +1 -0
index 6397f0a..d590d9c 100644
@@ -100,6 +100,7 @@ static int ds1338_send(I2CSlave *i2c, uint8_t data)
             break;
         case 5:
             s->now.tm_mon = from_bcd(data & 0x1f) - 1;
+            break;
         case 6:
             s->now.tm_year = from_bcd(data) + 100;
             break;
Signature · 1 line
1.7.9
#2 lore raw
In reply to Stefan Weil

Am 25.02.2012 14:50, schrieb Stefan Weil:

Quoted 16 lines

Without the break statement, case 5 sets month and year from the same data. This does not look correct.

The missing break was reported by splint.

---
hw/ds1338.c | 1 +

1 files changed, 1 insertions(+), 0 deletions(-)
hw/ds1338.c +0 -0
index 6397f0a..d590d9c 100644
@@ -100,6 +100,7 @@ static int ds1338_send(I2CSlave *i2c, uint8_t data)
 break;
Quoted 6 lines

case 5:
s->now.tm_mon = from_bcd(data & 0x1f) - 1;
+ break;
case 6:
s->now.tm_year = from_bcd(data) + 100;
break;

Ping. This is a simple bug fix. It was reviewed by Peter Maydell (thanks!). Could someone please commit it to QEMU master (maybe to stable-1.0, too)?

Regards,
Stefan Weil

Reviewed-by on v1 1/1
#3 lore raw
In reply to Stefan Weil

Am 25.02.2012 14:50, schrieb Stefan Weil:

Quoted 6 lines

Without the break statement, case 5 sets month and year from the same data. This does not look correct.

The missing break was reported by splint.

Assigning data to both month and year certainly makes no sense,

Andreas

Quoted 16 lines
---
 hw/ds1338.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
hw/ds1338.c +1 -0
index 6397f0a..d590d9c 100644
@@ -100,6 +100,7 @@ static int ds1338_send(I2CSlave *i2c, uint8_t data)
             break;
         case 5:
             s->now.tm_mon = from_bcd(data & 0x1f) - 1;
+            break;
         case 6:
             s->now.tm_year = from_bcd(data) + 100;
             break;
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#4 lore raw
In reply to Stefan Weil
Quoted 9 lines · Stefan Weil

Without the break statement, case 5 sets month and year from the same data. This does not look correct.

The missing break was reported by splint.

---
 hw/ds1338.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Sorry, looks like I missed a couple of your patches in my inbox.

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan