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 <s...@weilnetz.de>
Reviewed-by: Richard Henderson <richard.hender...@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.
r~