qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pflash: Avoid warnings from coverity
@ 2012-09-19 16:41 Stefan Weil
  2012-09-19 16:45 ` Peter Maydell
  2012-09-22 16:29 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
  0 siblings, 2 replies; 10+ messages in thread
From: Stefan Weil @ 2012-09-19 16:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Stefan Weil

hw/pflash_cfi01.c:209:
check_return: Calling function "bdrv_write" without checking return value (as is done elsewhere 35 out of 37 times).

hw/pflash_cfi02.c:144:
unterminated_default: The default case is not terminated by a 'break' statement.

hw/pflash_cfi02.c:238:
check_return: Calling function "bdrv_write" without checking return value (as is done elsewhere 35 out of 37 times).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 hw/pflash_cfi01.c |    6 ++++--
 hw/pflash_cfi02.c |    7 +++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/hw/pflash_cfi01.c b/hw/pflash_cfi01.c
index 56ed33f..27ae4aa 100644
--- a/hw/pflash_cfi01.c
+++ b/hw/pflash_cfi01.c
@@ -205,8 +205,10 @@ static void pflash_update(pflash_t *pfl, int offset,
         /* round to sectors */
         offset = offset >> 9;
         offset_end = (offset_end + 511) >> 9;
-        bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9),
-                   offset_end - offset);
+        if (bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9),
+                       offset_end - offset) == -1) {
+            fprintf(stderr, "pflash: Error writing to flash storage\n");
+        }
     }
 }
 
diff --git a/hw/pflash_cfi02.c b/hw/pflash_cfi02.c
index 3e2002e..bca7d1b 100644
--- a/hw/pflash_cfi02.c
+++ b/hw/pflash_cfi02.c
@@ -147,6 +147,7 @@ static uint32_t pflash_read (pflash_t *pfl, target_phys_addr_t offset,
         DPRINTF("%s: unknown command state: %x\n", __func__, pfl->cmd);
         pfl->wcycle = 0;
         pfl->cmd = 0;
+        /* Fall through */
     case 0x80:
         /* We accept reads during second unlock sequence... */
     case 0x00:
@@ -236,8 +237,10 @@ static void pflash_update(pflash_t *pfl, int offset,
         /* round to sectors */
         offset = offset >> 9;
         offset_end = (offset_end + 511) >> 9;
-        bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9),
-                   offset_end - offset);
+        if (bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9),
+                       offset_end - offset) == -1) {
+            fprintf(stderr, "pflash: Error writing to flash storage\n");
+        }
     }
 }
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-09-24  8:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-19 16:41 [Qemu-devel] [PATCH] pflash: Avoid warnings from coverity Stefan Weil
2012-09-19 16:45 ` Peter Maydell
2012-09-19 20:51   ` Stefan Weil
2012-09-20  8:31     ` Peter Maydell
2012-09-22 16:29 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
2012-09-22 16:58   ` Peter Maydell
2012-09-22 18:53   ` Stefan Weil
2012-09-24  7:48     ` Kevin Wolf
2012-09-24  8:41       ` Markus Armbruster
2012-09-24  8:53         ` Kevin Wolf

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).