From: Eric Blake <eblake@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>, qemu-devel@nongnu.org
Cc: "Peter Crosthwaite" <crosthwaite.peter@gmail.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Kevin Wolf" <kwolf@redhat.com>,
"Richard Henderson" <rth@twiddle.net>,
qemu-arm@nongnu.org, "Jason Wang" <jasowang@redhat.com>,
"Max Reitz" <mreitz@redhat.com>, "Fam Zheng" <famz@redhat.com>,
qemu-trivial@nongnu.org, "Alexander Graf" <agraf@suse.de>,
qemu-ppc@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
"Alberto Garcia" <berto@igalia.com>,
qemu-block@nongnu.org, "Igor Mitsyanko" <i.mitsyanko@gmail.com>,
"Yongbok Kim" <yongbok.kim@mips.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Max Filippov" <jcmvbkbc@gmail.com>,
"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value
Date: Thu, 22 Mar 2018 11:45:02 -0500 [thread overview]
Message-ID: <5a2e612c-368c-bc36-a852-0ce29bc36ab4@redhat.com> (raw)
In-Reply-To: <20180322161226.29796-5-lvivier@redhat.com>
On 03/22/2018 11:12 AM, Laurent Vivier wrote:
> Re-run Coccinelle script scripts/coccinelle/return_directly.cocci
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> +++ b/hw/arm/exynos4210.c
> @@ -156,12 +156,7 @@ void exynos4210_write_secondary(ARMCPU *cpu,
>
> static uint64_t exynos4210_calc_affinity(int cpu)
> {
> - uint64_t mp_affinity;
> -
> - /* Exynos4210 has 0x9 as cluster ID */
> - mp_affinity = (0x9 << ARM_AFF1_SHIFT) | cpu;
> -
> - return mp_affinity;
> + return (0x9 << ARM_AFF1_SHIFT) | cpu;
Unchanged by this rewrite, but since this is converting a signed 32-bit
int to an unsigned 64-bit value, are we sure that the upper 32 bits are
always set correctly? (Using unsigned values earlier in the expression
would require less head-scratching on whether it is correct). Any
changes should be a separate fix by the file's maintainer.
> +++ b/hw/misc/mos6522.c
> @@ -176,12 +176,8 @@ static void mos6522_set_sr_int(MOS6522State *s)
>
> static uint64_t mos6522_get_counter_value(MOS6522State *s, MOS6522Timer *ti)
> {
> - uint64_t d;
> -
> - d = muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - ti->load_time,
> + return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - ti->load_time,
> ti->frequency, NANOSECONDS_PER_SECOND);
Coccinelle missed that indentation is now off here.
> +++ b/hw/ppc/pnv_lpc.c
> @@ -125,25 +125,15 @@ static int pnv_lpc_dt_xscom(PnvXScomInterface *dev, void *fdt, int xscom_offset)
> static bool opb_read(PnvLpcController *lpc, uint32_t addr, uint8_t *data,
> int sz)
> {
> - bool success;
> -
> - /* XXX Handle access size limits and FW read caching here */
> - success = !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
> + return !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
> data, sz, false);
and here.
> +++ b/target/xtensa/translate.c
> @@ -1272,11 +1272,8 @@ XtensaOpcodeOps *
> xtensa_find_opcode_ops(const XtensaOpcodeTranslators *t,
> const char *name)
> {
> - XtensaOpcodeOps *ops;
> -
> - ops = bsearch(name, t->opcode, t->num_opcodes,
> + return bsearch(name, t->opcode, t->num_opcodes,
> sizeof(XtensaOpcodeOps), compare_opcode_ops);
and here
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2018-03-22 16:45 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-22 16:12 [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle Laurent Vivier
2018-03-22 16:12 ` [Qemu-devel] [PATCH 1/4] error: Strip trailing '\n' from error string arguments (again again) Laurent Vivier
2018-03-22 16:12 ` [Qemu-devel] [PATCH 2/4] error: Remove NULL checks on error_propagate() calls Laurent Vivier
2018-03-23 20:50 ` Eric Blake
2018-03-26 8:40 ` Laurent Vivier
2018-03-22 16:12 ` [Qemu-devel] [PATCH 3/4] qdict: remove useless cast Laurent Vivier
2018-03-22 16:23 ` Dr. David Alan Gilbert
2018-03-27 3:01 ` Fam Zheng
2018-03-22 16:12 ` [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value Laurent Vivier
2018-03-22 16:45 ` Eric Blake [this message]
2018-03-22 16:51 ` Max Filippov
2018-03-22 16:58 ` Laurent Vivier
2018-03-22 17:19 ` Max Filippov
2018-03-22 17:23 ` Peter Maydell
2018-03-22 17:26 ` Max Filippov
2018-03-22 17:30 ` Eric Blake
2018-03-22 17:40 ` Peter Maydell
2018-03-22 16:59 ` Eric Blake
2018-03-22 17:06 ` Max Filippov
2018-03-22 23:06 ` David Gibson
2018-03-23 2:14 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-03-23 10:44 ` [Qemu-devel] " Alberto Garcia
2018-03-22 16:27 ` [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle Eric Blake
2018-03-22 16:45 ` Eric Blake
2018-03-22 17:57 ` no-reply
2018-03-22 18:00 ` Peter Maydell
2018-03-22 19:12 ` Eric Blake
2018-03-22 19:17 ` Peter Maydell
2018-03-23 12:37 ` Michael Tokarev
2018-03-23 12:40 ` Laurent Vivier
2018-03-23 17:42 ` Eric Blake
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=5a2e612c-368c-bc36-a852-0ce29bc36ab4@redhat.com \
--to=eblake@redhat.com \
--cc=agraf@suse.de \
--cc=armbru@redhat.com \
--cc=aurelien@aurel32.net \
--cc=berrange@redhat.com \
--cc=berto@igalia.com \
--cc=crosthwaite.peter@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=dgilbert@redhat.com \
--cc=ehabkost@redhat.com \
--cc=famz@redhat.com \
--cc=i.mitsyanko@gmail.com \
--cc=jasowang@redhat.com \
--cc=jcmvbkbc@gmail.com \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=rth@twiddle.net \
--cc=yongbok.kim@mips.com \
/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).