ds1338: Add missing break statement
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
@@ -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
Quoted 2 lines · Stefan Weil
Without the break statement, case 5 sets month and year from the same data. This does not look correct.
Yep, looks like a simple missing break, checked against the datasheet at http://datasheets.maxim-ic.com/en/ds/DS1338-DS1338Z.pdf
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.
Signed-off-by Stefan Weil <[email protected]>---
hw/ds1338.c| 1 +1 files changed, 1 insertions(+), 0 deletions(-)hw/ds1338.c +0
-0@@ -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
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.
Signed-off-by Stefan Weil <[email protected]>
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@@ -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
Stefan Hajnoczi
AppliedQuoted 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.
Signed-off-by Stefan Weil <[email protected]>--- 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