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