From: Vladimir Sementsov-Ogievskiy Date: Thu, 5 Dec 2019 17:46:16 +0000 (+0300) Subject: net/net: Clean up variable shadowing in net_client_init() X-Git-Tag: v5.0.0-rc0~176^2~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=33c9642f657193bc478c96f08434ae746397b70e;p=thirdparty%2Fqemu.git net/net: Clean up variable shadowing in net_client_init() Variable int err in inner scope shadows Error *err in outer scope. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20191205174635.18758-3-vsementsov@virtuozzo.com> Signed-off-by: Markus Armbruster --- diff --git a/net/net.c b/net/net.c index 84aa6d8d003..9e93c3f8a1e 100644 --- a/net/net.c +++ b/net/net.c @@ -1126,16 +1126,13 @@ static int net_client_init(QemuOpts *opts, bool is_netdev, Error **errp) prefix_addr = substrings[0]; - if (substrings[1]) { - /* User-specified prefix length. */ - int err; - - err = qemu_strtoul(substrings[1], NULL, 10, &prefix_len); - if (err) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "ipv6-prefixlen", "a number"); - goto out; - } + /* Handle user-specified prefix length. */ + if (substrings[1] && + qemu_strtoul(substrings[1], NULL, 10, &prefix_len)) + { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "ipv6-prefixlen", "a number"); + goto out; } qemu_opt_set(opts, "ipv6-prefix", prefix_addr, &error_abort);