From patchwork Thu Dec 5 17:46:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1204763 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47TNfk1sCdz9sPJ for ; Fri, 6 Dec 2019 04:55:26 +1100 (AEDT) Received: from localhost ([::1]:58839 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icvLW-00081N-0Q for incoming@patchwork.ozlabs.org; Thu, 05 Dec 2019 12:55:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45176) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icvDG-0007b7-Iq for qemu-devel@nongnu.org; Thu, 05 Dec 2019 12:46:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icvDD-0003Xh-US for qemu-devel@nongnu.org; Thu, 05 Dec 2019 12:46:50 -0500 Received: from relay.sw.ru ([185.231.240.75]:48258) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icvDA-0003S1-7u for qemu-devel@nongnu.org; Thu, 05 Dec 2019 12:46:46 -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 1icvD6-00013M-0h; Thu, 05 Dec 2019 20:46:40 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Subject: [PATCH v8 02/21] net/net: Clean up variable shadowing in net_client_init() Date: Thu, 5 Dec 2019 20:46:16 +0300 Message-Id: <20191205174635.18758-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191205174635.18758-1-vsementsov@virtuozzo.com> References: <20191205174635.18758-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jason Wang , vsementsov@virtuozzo.com, armbru@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.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é --- 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) 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);