From patchwork Sun May 2 23:18:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 430472 Delivered-To: patch@linaro.org Received: by 2002:a17:907:764d:0:0:0:0 with SMTP id kj13csp1225515ejc; Sun, 2 May 2021 16:27:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdcd/gc2cfFILfbSlKXvhL8xpuGJwi7MCrisXfCue6ecdudBwArUB/TU4xaajsJE37O4JW X-Received: by 2002:a37:270b:: with SMTP id n11mr16775117qkn.246.1619998052410; Sun, 02 May 2021 16:27:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619998052; cv=none; d=google.com; s=arc-20160816; b=fjLrDzV2DW8674bxcPqfmxaqIyNNS6eERNfl2egqxHKVeM9J8Y/3wdZEc5g4IN81Vy kMBbvMrSnM0jLy87YOQMktftBdXFF7aZYwg/QAQ0UbJ/gLknqfcj/CPGIRRJc1pDxPin Hp3/yVt4E66o7ikXDPhaFg5G2W7VrYn++vuewblAj3bS9d9tQtDPq4TA0B37ET2uWkmz aBYVtMGFGRO+hUbZhdhVCMHnE9RU0ASOgZddJ+US6MwXNE+vU2D/VzfDzC1cEBJkr7ZZ MT7r0rucK85o9k/VG9G9iy2UtmW1YXlH9a6wWeGz58ydadVddyKL9ecvJPFOMrv9ub2B opgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=4cZuoxcwQ6eXvc/QAg7Oih5qEjK3cLKB2wBaiFUenJA=; b=SYSguuqpLlbhxhOKOJXjzrYoXbxgQ83z95/uzuqdxet7u2HvrU4vKb/5uggn49y972 LS8+0lwzLHsVQmE2KEtXnCpGPXSvN7EM8fIVsh7NVXkIEdiXQ+ktzaBiCdLSKAFzXKGM T0K8eTQb9T4modX8DFFwB8kY+D7cAstrmPeORxfbVIqOoXkhhwfsHxssnn7vJ0f4Hw2g K5E8fFYovDZlX0bO0rcybSelPH3ffKEqHEtGCOmvGrGpTiy2MXKfJs1+mhxlaBpFr+st LWmalbfPYN9VoZ3zXzceHxCa+aon4Dxg+OCkmSr+BlHLm4Ijm2nLnPIGY260SDSAYf7J KgaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FTNlv1ZE; 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 h7si7896406qkb.75.2021.05.02.16.27.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 02 May 2021 16:27:32 -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=FTNlv1ZE; 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]:56656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldLUp-00028l-PM for patch@linaro.org; Sun, 02 May 2021 19:27:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldLMU-0008Dp-Gz for qemu-devel@nongnu.org; Sun, 02 May 2021 19:18:54 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:42879) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ldLMQ-0002qn-6m for qemu-devel@nongnu.org; Sun, 02 May 2021 19:18:54 -0400 Received: by mail-pj1-x1032.google.com with SMTP id j6-20020a17090adc86b02900cbfe6f2c96so2309720pjv.1 for ; Sun, 02 May 2021 16:18:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4cZuoxcwQ6eXvc/QAg7Oih5qEjK3cLKB2wBaiFUenJA=; b=FTNlv1ZEPxIHdsw9/PcT6g8lFQtXzm4QImZKOKke+yIyO2Bjg+5jUivJHk9Qj9i0+K kifhEzWHyBYHzD/YR35ZMXfFKEVoiYGyDqP77uU067im+RfO4P8IBpqQgZuHIxHUhNVb OuB3wCDa6c/jWjw8wmV5yBVNjThlJN/yLQTbWORcWNRdDjanwiuqAvsVn1CtOZA0RGEd Mt7usMGanvItBxlBr2YO6d6C065+kMj8N296699Ovj26DM9c67spfSpooe6ajOyZcjn2 kQb/OcliLttwiXxU1gyJuPXOiNtAQdrfvaGjliFNU9642E1qcIGDDJD3B7xNJOa+Zexw MNKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4cZuoxcwQ6eXvc/QAg7Oih5qEjK3cLKB2wBaiFUenJA=; b=E+AtAoFo5SCI7QoC1ZLT5zH2UbNnMoqSeW9uA5HtJhuSxdJ1cr8MPELbONoa35zB+x KHyJNaksZ5r45Fa9R44OKvpPmj9SXPa6CUTcbITLfpwZQLvPHGSL0pqxJvwNS6+szNpJ z8pVUH66f+4db+Io+dyj1K+nhmkoJHPSWap2hUJvvC4T7zeKPnZ4Vjb5T6iq1ttFeuW+ R65MguNRfj2bLk//ZyboAh3n4U6moTrnhOOACt9GbhHYoTS7lRTWUa2agmni137CsPOS OezCwIz2CuGz2OpCpgOdx+dGfdeuXro52Vr8/SPvcelA/6fHagRkJSc0NRBUGMvS0Wrd PZwA== X-Gm-Message-State: AOAM530zAtxWO7vlAekFJsd/vY6stzBQwkbFVhLkLqS86D0uftFM+rXB EvPpV+pckW7KJk+Qq8o4RPd394+++DwH4A== X-Received: by 2002:a17:90b:2390:: with SMTP id mr16mr11196668pjb.133.1619997528983; Sun, 02 May 2021 16:18:48 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id k17sm7146236pfa.68.2021.05.02.16.18.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 May 2021 16:18:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 04/28] tcg: Remove error return from tcg_region_initial_alloc__locked Date: Sun, 2 May 2021 16:18:20 -0700 Message-Id: <20210502231844.1977630-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210502231844.1977630-1-richard.henderson@linaro.org> References: <20210502231844.1977630-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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=ham autolearn_force=no X-Spam_action: no action 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?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" All callers immediately assert on error, so move the assert into the function itself. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/tcg.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) -- 2.25.1 Reviewed-by: Alex Bennée Reviewed-by: Luis Pires diff --git a/tcg/tcg.c b/tcg/tcg.c index 795a71ff25..8b57e93ca2 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -723,9 +723,10 @@ static bool tcg_region_alloc(TCGContext *s) * Perform a context's first region allocation. * This function does _not_ increment region.agg_size_full. */ -static inline bool tcg_region_initial_alloc__locked(TCGContext *s) +static void tcg_region_initial_alloc__locked(TCGContext *s) { - return tcg_region_alloc__locked(s); + bool err = tcg_region_alloc__locked(s); + g_assert(!err); } /* Call from a safe-work context */ @@ -740,9 +741,7 @@ void tcg_region_reset_all(void) for (i = 0; i < n_ctxs; i++) { TCGContext *s = qatomic_read(&tcg_ctxs[i]); - bool err = tcg_region_initial_alloc__locked(s); - - g_assert(!err); + tcg_region_initial_alloc__locked(s); } qemu_mutex_unlock(®ion.lock); @@ -879,11 +878,7 @@ void tcg_region_init(void) /* In user-mode we support only one ctx, so do the initial allocation now */ #ifdef CONFIG_USER_ONLY - { - bool err = tcg_region_initial_alloc__locked(tcg_ctx); - - g_assert(!err); - } + tcg_region_initial_alloc__locked(tcg_ctx); #endif } @@ -945,7 +940,6 @@ void tcg_register_thread(void) MachineState *ms = MACHINE(qdev_get_machine()); TCGContext *s = g_malloc(sizeof(*s)); unsigned int i, n; - bool err; *s = tcg_init_ctx; @@ -969,8 +963,7 @@ void tcg_register_thread(void) tcg_ctx = s; qemu_mutex_lock(®ion.lock); - err = tcg_region_initial_alloc__locked(tcg_ctx); - g_assert(!err); + tcg_region_initial_alloc__locked(s); qemu_mutex_unlock(®ion.lock); } #endif /* !CONFIG_USER_ONLY */