diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 2019-12-05 20:46:16 +0300 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2019-12-18 08:36:16 +0100 |
commit | 33c9642f657193bc478c96f08434ae746397b70e (patch) | |
tree | e04faa1ae381d10e4a5621ccf49cc7aca790ac67 /net/net.c | |
parent | 0cf9e2b4f8e85477fbb50c9beb030aaf400d581a (diff) | |
download | qemu-33c9642f657193bc478c96f08434ae746397b70e.zip qemu-33c9642f657193bc478c96f08434ae746397b70e.tar.gz qemu-33c9642f657193bc478c96f08434ae746397b70e.tar.bz2 |
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 <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191205174635.18758-3-vsementsov@virtuozzo.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'net/net.c')
-rw-r--r-- | net/net.c | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -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); |