5544c1b
From 4377b521568c8dca87cfb8fad5629b3203c08032 Mon Sep 17 00:00:00 2001
5544c1b
From: Stefan Weil <sw@weilnetz.de>
5544c1b
Date: Sat, 1 Sep 2012 13:00:48 +0200
5544c1b
Subject: [PATCH] pflash_cfi01: Fix warning caused by unreachable code
5544c1b
5544c1b
Report from smatch:
5544c1b
hw/pflash_cfi01.c:431 pflash_write(180) info: ignoring unreachable code.
5544c1b
5544c1b
Instead of removing the return statement after the switch statement,
5544c1b
the patch replaces the return statements in the switch statement by
5544c1b
break statements. Other switch statements in the same code do it also
5544c1b
like that.
5544c1b
5544c1b
Signed-off-by: Stefan Weil <sw@weilnetz.de>
5544c1b
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
5544c1b
(cherry picked from commit 12dabc79f976d66755025272f7e2e8e4da31715a)
5544c1b
5544c1b
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1b
---
5544c1b
 hw/pflash_cfi01.c | 8 ++++----
5544c1b
 1 file changed, 4 insertions(+), 4 deletions(-)
5544c1b
5544c1b
diff --git a/hw/pflash_cfi01.c b/hw/pflash_cfi01.c
5544c1b
index d56b51a..ac503cf 100644
5544c1b
--- a/hw/pflash_cfi01.c
5544c1b
+++ b/hw/pflash_cfi01.c
5544c1b
@@ -320,7 +320,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset,
5544c1b
         }
5544c1b
         pfl->wcycle++;
5544c1b
         pfl->cmd = cmd;
5544c1b
-        return;
5544c1b
+        break;
5544c1b
     case 1:
5544c1b
         switch (pfl->cmd) {
5544c1b
         case 0x10: /* Single Byte Program */
5544c1b
@@ -375,7 +375,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset,
5544c1b
         default:
5544c1b
             goto error_flash;
5544c1b
         }
5544c1b
-        return;
5544c1b
+        break;
5544c1b
     case 2:
5544c1b
         switch (pfl->cmd) {
5544c1b
         case 0xe8: /* Block write */
5544c1b
@@ -406,7 +406,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset,
5544c1b
         default:
5544c1b
             goto error_flash;
5544c1b
         }
5544c1b
-        return;
5544c1b
+        break;
5544c1b
     case 3: /* Confirm mode */
5544c1b
         switch (pfl->cmd) {
5544c1b
         case 0xe8: /* Block write */
5544c1b
@@ -422,7 +422,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset,
5544c1b
         default:
5544c1b
             goto error_flash;
5544c1b
         }
5544c1b
-        return;
5544c1b
+        break;
5544c1b
     default:
5544c1b
         /* Should never happen */
5544c1b
         DPRINTF("%s: invalid write state\n",  __func__);