From: Stefan Weil <sw@weilnetz.de>
To: qemu-trivial <qemu-trivial@nongnu.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] pflash_cfi01: Fix warning caused by unreachable code
Date: Thu, 20 Sep 2012 18:57:05 +0200 [thread overview]
Message-ID: <505B4AE1.6000505@weilnetz.de> (raw)
In-Reply-To: <1346497248-14659-1-git-send-email-sw@weilnetz.de>
Am 01.09.2012 13:00, schrieb Stefan Weil:
> 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<sw@weilnetz.de>
> ---
> 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__);
>
Ping?
next prev parent reply other threads:[~2012-09-20 16:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-01 11:00 [Qemu-devel] [PATCH] pflash_cfi01: Fix warning caused by unreachable code Stefan Weil
2012-09-20 16:57 ` Stefan Weil [this message]
2012-09-22 15:44 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=505B4AE1.6000505@weilnetz.de \
--to=sw@weilnetz.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).