From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7lRb-0003lh-Qq for qemu-devel@nongnu.org; Sat, 01 Sep 2012 07:00:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T7lRa-0000Q3-NN for qemu-devel@nongnu.org; Sat, 01 Sep 2012 07:00:51 -0400 From: Stefan Weil Date: Sat, 1 Sep 2012 13:00:48 +0200 Message-Id: <1346497248-14659-1-git-send-email-sw@weilnetz.de> Subject: [Qemu-devel] [PATCH] pflash_cfi01: Fix warning caused by unreachable code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-trivial@nongnu.org Cc: Stefan Weil , qemu-devel@nongnu.org Report from smatch: hw/pflash_cfi01.c:431 pflash_write(180) info: ignoring unreachable code. Instead of removing the return statement after the switch statement, the patch replaces the return statements in the switch statement by break statements. Other switch statements in the same code do it also like that. Signed-off-by: Stefan Weil --- hw/pflash_cfi01.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/pflash_cfi01.c b/hw/pflash_cfi01.c index d1c7423..56ed33f 100644 --- a/hw/pflash_cfi01.c +++ b/hw/pflash_cfi01.c @@ -320,7 +320,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset, } pfl->wcycle++; pfl->cmd = cmd; - return; + break; case 1: switch (pfl->cmd) { case 0x10: /* Single Byte Program */ @@ -375,7 +375,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset, default: goto error_flash; } - return; + break; case 2: switch (pfl->cmd) { case 0xe8: /* Block write */ @@ -406,7 +406,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset, default: goto error_flash; } - return; + break; case 3: /* Confirm mode */ switch (pfl->cmd) { case 0xe8: /* Block write */ @@ -422,7 +422,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset, default: goto error_flash; } - return; + break; default: /* Should never happen */ DPRINTF("%s: invalid write state\n", __func__); -- 1.7.10