From: "Michal Prívozník" <mprivozn@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>,
Stefan Weil <sw@weilnetz.de>,
qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org,
Alistair Francis <alistair.francis@wdc.com>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH] device_tree: Fix compiler error
Date: Tue, 9 Nov 2021 09:46:29 +0100 [thread overview]
Message-ID: <13855c06-701b-178e-7930-e046633d3398@redhat.com> (raw)
In-Reply-To: <c99a3838-7cbd-e6aa-742a-b943d3e460a5@linaro.org>
On 11/9/21 9:38 AM, Richard Henderson wrote:
> On 11/8/21 9:07 PM, Stefan Weil wrote:
>> A build with gcc (Debian 10.2.1-6) 10.2.1 20210110 fails:
>>
>> ../../../softmmu/device_tree.c: In function ‘qemu_fdt_add_path’:
>> ../../../softmmu/device_tree.c:560:18: error: ‘retval’ may be used
>> uninitialized in this function [-Werror=maybe-uninitialized]
>> 560 | int namelen, retval;
>> | ^~~~~~
>>
>> This is not a real error, but the compiler can be satisfied with a
>> small change.
>>
>> Fixes: b863f0b75852 ("device_tree: Add qemu_fdt_add_path")
>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
> Though I think there's a good deal that could be cleaned up about this
> function:
>
> (1a) Remove the unused return value?
> The single use does not check the return.
>
> (1b) Don't attempt to return a node, merely a success/failure code.
> Certainly the local documentation here could be improved...
>
> (1c) Return parent; make retval local to the loop.
>
> (2) Merge p and path; there's no point retaining the unmodified parameter.
>
> (3) Move name and namelen inside the loop.
(4) swap if() bodies?
if (retval == -FDT_ERR_NOTFOUND) {
} else if (retval < 0) {
}
Michal
next prev parent reply other threads:[~2021-11-09 8:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-08 20:07 [PATCH] device_tree: Fix compiler error Stefan Weil
2021-11-08 22:43 ` Alistair Francis
2021-11-09 7:58 ` Stefan Weil
2021-11-09 8:38 ` Richard Henderson
2021-11-09 8:46 ` Michal Prívozník [this message]
2021-12-17 10:11 ` Laurent Vivier
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=13855c06-701b-178e-7930-e046633d3398@redhat.com \
--to=mprivozn@redhat.com \
--cc=alistair.francis@wdc.com \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sw@weilnetz.de \
/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).