diff options
author | Stefan Weil <sw@weilnetz.de> | 2012-09-23 08:51:01 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@gmail.com> | 2012-10-05 13:54:35 +0200 |
commit | 7a608f562ebd91e811ed0b725e528c894e4f19c4 (patch) | |
tree | 19cce17ab0e39535b22c3b6732282efe514d5e1c /hw/onenand.c | |
parent | a14c74928ba1fdaada515717f4d3c3fa3275d6f7 (diff) |
hw: Fix return value check for bdrv_read, bdrv_write
Those functions return -errno in case of an error.
The old code would typically only detect EPERM (1) errors.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Diffstat (limited to 'hw/onenand.c')
-rw-r--r-- | hw/onenand.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/onenand.c b/hw/onenand.c index db6af682c4..0f7b755a6d 100644 --- a/hw/onenand.c +++ b/hw/onenand.c @@ -351,7 +351,7 @@ static inline int onenand_erase(OneNANDState *s, int sec, int num) for (; num > 0; num--, sec++) { if (s->bdrv_cur) { int erasesec = s->secs_cur + (sec >> 5); - if (bdrv_write(s->bdrv_cur, sec, blankbuf, 1)) { + if (bdrv_write(s->bdrv_cur, sec, blankbuf, 1) < 0) { goto fail; } if (bdrv_read(s->bdrv_cur, erasesec, tmpbuf, 1) < 0) { |