From nobody Fri May 3 08:41:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1574880108; cv=none; d=zohomail.com; s=zohoarc; b=dTyJjDvky76tHYvQmcP/rco4DGUQznZNuS7wKc2UCekyY26uoWWo2/DHhFd+PzFN0lpDGa5cq0vc1C8Lgfkh6ZmryD7RjdEAd37S4w8I60UgXx2QyE8OqVaov8GqYQocHJF/ZEVRoS3Cclx+ekDbjIsMB/p+n/2IiGjB3vD0x/I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574880108; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=yHy7OZSa7rU3CszXcfVoHoUn7Fyt2HQMGMBdsHTYg30=; b=GWipIvZHGOB8XApfCpzBeqmfnHJAFbVob6V+s9DdgLrzAc+o8it3Et+rQFqIDy/PI9PdpIbnbwA4aR+zbAd2JVVBsDhsF6Fe4h01Cpe4avFz6Y2VzqetooAYcJVTptwOLcy6Ek9YaDccEgCcjrB72Q/inxL91KQw2MzInBxNago= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574880108081525.7275913136123; Wed, 27 Nov 2019 10:41:48 -0800 (PST) Received: from localhost ([::1]:41732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ia2G2-0002cN-DS for importer@patchew.org; Wed, 27 Nov 2019 13:41:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39613) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ia27H-0003kN-4f for qemu-devel@nongnu.org; Wed, 27 Nov 2019 13:32:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ia27E-0005DK-UY for qemu-devel@nongnu.org; Wed, 27 Nov 2019 13:32:43 -0500 Received: from relay.sw.ru ([185.231.240.75]:50848) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ia27D-0005Bw-1I for qemu-devel@nongnu.org; Wed, 27 Nov 2019 13:32:40 -0500 Received: from vovaso.qa.sw.ru ([10.94.3.0] helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1ia27A-0002ik-3Q; Wed, 27 Nov 2019 21:32:36 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Subject: [PATCH v6] net/net: Clean up variable shadowing in net_client_init() Date: Wed, 27 Nov 2019 21:32:35 +0300 Message-Id: <20191127183235.14143-1-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: philmd@redhat.com, jasowang@redhat.com, vsementsov@virtuozzo.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" 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=C3=A9 --- v6: add Philippe's r-b net/net.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/net/net.c b/net/net.c index 84aa6d8d00..9e93c3f8a1 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) =20 prefix_addr =3D substrings[0]; =20 - if (substrings[1]) { - /* User-specified prefix length. */ - int err; - - err =3D 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; } =20 qemu_opt_set(opts, "ipv6-prefix", prefix_addr, &error_abort); --=20 2.21.0