From patchwork Mon Sep 4 16:12:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 719991 Delivered-To: patch@linaro.org Received: by 2002:adf:d08b:0:b0:31d:da82:a3b4 with SMTP id y11csp1686683wrh; Mon, 4 Sep 2023 09:15:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGS8C5oaxAbBMyqazr0QFoCVEVaD4fYxWk0OwZz9uwZQU/9TeT9d8bOpPglk+Sn8L4+zBaB X-Received: by 2002:a67:f1d1:0:b0:447:6cf0:7119 with SMTP id v17-20020a67f1d1000000b004476cf07119mr9441521vsm.30.1693844158264; Mon, 04 Sep 2023 09:15:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693844158; cv=none; d=google.com; s=arc-20160816; b=PiKnYeLIiqw4ESUxpnUPKuwIAsZ1IKv5jgoca0XH99Thy7JIBoKUTb3oPmI8cXoA8o IcEnI14H24a138HBI3t6Z4u5ovHc+Bm8lm3huD31HIIwk8+YpUtwFwVphaEGa8Nw/MRp j3G70Egz2/tg/8HkaXr9BhRJK/HjOgFVPlRbl5ccTFuvtQLDSQ6NK7bw6sJTe5sWTJUP 8FlqhL+iqZQLWr4wKIkpjgww1qHQZIkBlfAd1tfYdUmGR2YnBNOiEmXRlH075mU43uSG DsJ/b5IFkcehXceLmaV5YApYckieHELFIVl5wgQLTX3EW0rajVp7ik+i4ocyuynRthB4 Es4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GAJ8IyF6qJ4L0zeYktHFZ3FRJiDz0/SjvkZRz5aktOM=; fh=Q5UJePQCPk73Niy21rUDClvVxazdpvTyPM+Vdv/IeIE=; b=iIw7sOTMXMd2bh5Ap+COmg9XoaPVkqxDaHOrdTVEqMLOChazhCJ9KZC1fJOquXfosf DYA8yYNUwN507Vktvak8F1mjPVAM+PsgjziHqUTRdt3d0ncCLFe27gxjS83OaD+Pp9IB ZeDv7ZAPrZdrbCtOw1sR65yhJOezgsi0whnTGNUWC/8eP7iio7eoxpN5QgAnBT6SsF+o lqinGi+bG9Gl95aV/mBvXHMikNU/ZFIv3bShnYwIqc1Zk8ABoXyqZFuRsEM0UvzWtinu ZLapLTpUuxRy6eyfmUxrUelRoqW+tBIa2nE5b2PLrZKmqxuhybdk8mqjo/cWvrT2kloi AlPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UIDrm9Hj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p6-20020a67f346000000b004503d271b94si769832vsm.809.2023.09.04.09.15.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Sep 2023 09:15:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UIDrm9Hj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qdCDY-0005L0-P4; Mon, 04 Sep 2023 12:14:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qdCDX-0005Ds-MJ for qemu-devel@nongnu.org; Mon, 04 Sep 2023 12:14:23 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qdCDV-0007k5-1x for qemu-devel@nongnu.org; Mon, 04 Sep 2023 12:14:23 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-99c3d3c3db9so250363366b.3 for ; Mon, 04 Sep 2023 09:14:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693844059; x=1694448859; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GAJ8IyF6qJ4L0zeYktHFZ3FRJiDz0/SjvkZRz5aktOM=; b=UIDrm9HjnlTLSi474CgCICY3xhEYFyAdf/M8GAeAQfUm7bW8pP1kK63rxSRuWlgveX 6VpXlItFKU+G7k9ZoWJVbiddWMR99P54Pk+wJyE1+4XOfrzqW5jX/di9LFqwjyh3fJop 105DRdg66KhXt5RTGzeoHrs7rVyIUqjdnK8tGeKOQmQYI4XMw5dSMg0CWKSgQxFpxf4I 0Rlav2/U03ITaSlZgy9gfmotlXo+XVhP2N5vqRJcqnz1UsQO3ANfWJR66jE+BE4NF1SA tQo+Y60cpbGt/GK0k5oFREVqfUjKeaDBZh4nef+7c8HbfWwSmOc4SkcQveIU7A/4u8VD dXxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693844059; x=1694448859; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GAJ8IyF6qJ4L0zeYktHFZ3FRJiDz0/SjvkZRz5aktOM=; b=OnUVwLn6EXA/G1mO+1NiAfDu8nbz1/YMod3L4c+n+xqosFTauAjL+r49Sl9vvR9rQi ksqpsWFsT3ObEtYZT2kKtXOs6k9V8XVLN8VvYyPPMTuMmqWhrpNaHFiWDcFKKYSrSY1Z jXfzVgYoMS02MAak7VkJZzbvPuGMCWqD3PNE8Sq/Oz4uBkL8gvzCr8IpBGtGikKLfkCP 2iGd1mEJLNXv0RpaebRrojcFs7aThJ4tlv3aAgm7roWOcXW/t4BEH/TgO0B4XPYotHBK tKCiVhc/rEXx9Xechq6tYgZH04r85ehE2gm1r/PphqpU+4aaZnXSQZoz4CCCmsAZ7Q2J SuVQ== X-Gm-Message-State: AOJu0Yy7YgmwfM0t3+Lx4EknrLejqg9Gscmt2MIQQSdC1MbmFDCEgmdO Iq3GdRsQXWfMnx6oUGDVndYtfQ== X-Received: by 2002:a17:907:7813:b0:9a2:16e2:35c with SMTP id la19-20020a170907781300b009a216e2035cmr7922548ejc.31.1693844059744; Mon, 04 Sep 2023 09:14:19 -0700 (PDT) Received: from m1x-phil.lan ([176.187.209.227]) by smtp.gmail.com with ESMTPSA id pw9-20020a17090720a900b0098884f86e41sm6270060ejb.123.2023.09.04.09.14.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 04 Sep 2023 09:14:19 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Markus Armbruster , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH v2 18/22] semihosting/arm-compat: Clean up local variable shadowing Date: Mon, 4 Sep 2023 18:12:30 +0200 Message-ID: <20230904161235.84651-19-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230904161235.84651-1-philmd@linaro.org> References: <20230904161235.84651-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=philmd@linaro.org; helo=mail-ej1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Fix: semihosting/arm-compat-semi.c: In function ‘do_common_semihosting’: semihosting/arm-compat-semi.c:379:13: warning: declaration of ‘ret’ shadows a previous local [-Wshadow=local] 379 | int ret, err = 0; | ^~~ semihosting/arm-compat-semi.c:370:14: note: shadowed declaration is here 370 | uint32_t ret; | ^~~ semihosting/arm-compat-semi.c:682:27: warning: declaration of ‘ret’ shadows a previous local [-Wshadow=local] 682 | abi_ulong ret; | ^~~ semihosting/arm-compat-semi.c:370:9: note: shadowed declaration is here 370 | int ret; | ^~~ Signed-off-by: Philippe Mathieu-Daudé --- semihosting/arm-compat-semi.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index 564fe17f75..85852a15b8 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -367,7 +367,7 @@ void do_common_semihosting(CPUState *cs) target_ulong ul_ret; char * s; int nr; - uint32_t ret; + int ret; int64_t elapsed; nr = common_semi_arg(cs, 0) & 0xffffffffU; @@ -376,7 +376,7 @@ void do_common_semihosting(CPUState *cs) switch (nr) { case TARGET_SYS_OPEN: { - int ret, err = 0; + int err = 0; int hostfd; GET_ARG(0); @@ -679,14 +679,11 @@ void do_common_semihosting(CPUState *cs) * allocate it using sbrk. */ if (!ts->heap_limit) { - abi_ulong ret; - ts->heap_base = do_brk(0); limit = ts->heap_base + COMMON_SEMI_HEAP_SIZE; /* Try a big heap, and reduce the size if that fails. */ for (;;) { - ret = do_brk(limit); - if (ret >= limit) { + if (do_brk(limit) >= limit) { break; } limit = (ts->heap_base >> 1) + (limit >> 1);