From: Chen Gang <gang.chen.5i5j@gmail.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: QEMU Trivial <qemu-trivial@nongnu.org>,
Peter Maydell <peter.maydell@linaro.org>,
Markus Armbruster <armbru@redhat.com>,
Anthony Liguori <aliguori@amazon.com>,
QEMU Developers <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH trivial 2/3] vl: remove redundant local variable 'res'
Date: Tue, 08 Apr 2014 20:02:57 +0800 [thread overview]
Message-ID: <5343E571.60407@gmail.com> (raw)
In-Reply-To: <5343E516.3020103@gmail.com>
In function, if no additional resources to free before quit, commonly,
need not use additional local variable 'res' to notice about it. So
remove it to simplify code.
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
vl.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/vl.c b/vl.c
index 7505002..377f962 100644
--- a/vl.c
+++ b/vl.c
@@ -1188,18 +1188,16 @@ DeviceState *get_boot_device(uint32_t position)
{
uint32_t counter = 0;
FWBootEntry *i = NULL;
- DeviceState *res = NULL;
if (!QTAILQ_EMPTY(&fw_boot_order)) {
QTAILQ_FOREACH(i, &fw_boot_order, link) {
if (counter == position) {
- res = i->dev;
- break;
+ return i->dev;
}
counter++;
}
}
- return res;
+ return NULL;
}
/*
--
1.7.9.5
next prev parent reply other threads:[~2014-04-08 12:03 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-27 1:16 [Qemu-devel] [PATCH] vl.c: use 'break' instead of 'continue' in configure_accelerator() Chen Gang
2014-03-27 7:55 ` Marcel Apfelbaum
2014-03-27 9:54 ` Chen Gang
2014-03-27 8:59 ` Markus Armbruster
2014-03-27 10:01 ` Chen Gang
2014-03-30 14:44 ` Chen Gang
2014-03-31 12:38 ` Markus Armbruster
2014-03-31 12:53 ` Chen Gang
2014-03-31 13:01 ` Peter Maydell
2014-03-31 13:12 ` Chen Gang
2014-03-31 13:16 ` Peter Maydell
2014-03-31 13:26 ` Chen Gang
2014-03-31 13:33 ` Peter Maydell
2014-03-31 23:50 ` Chen Gang
2014-04-04 9:39 ` [Qemu-devel] [PATCH-trivial v2] vl: Report accelerator not supported for target more nicely Chen Gang
2014-04-04 10:57 ` Markus Armbruster
2014-04-06 12:30 ` Chen Gang
2014-04-06 6:32 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-04-06 12:32 ` Chen Gang
2014-04-08 12:00 ` [Qemu-devel] [PATCH trivial 0/3] vl: simplify code for main() and get_boot_device() Chen Gang
2014-04-08 12:01 ` [Qemu-devel] [PATCH trivial 1/3] vl: remove useless 'continue' Chen Gang
2014-04-08 12:02 ` Chen Gang [this message]
2014-04-08 12:05 ` [Qemu-devel] [PATCH trivial 3/3] vl: remove local variable 'args' in the middle of code block Chen Gang
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=5343E571.60407@gmail.com \
--to=gang.chen.5i5j@gmail.com \
--cc=aliguori@amazon.com \
--cc=armbru@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=peter.maydell@linaro.org \
--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).