Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3A42274B35 for ; Sun, 24 Aug 2025 14:08:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756044521; cv=none; b=FVmZTtyL6/M9sgPV51GtCo992sv/FNvWCuyvhBFeG0bv2MSh45+862bGybP0PhkruGxLCg4qO0NR6JHM4ze8ggImHqPwJ1DcAT0svd1ZBJRQr87HljBcfUcGEnMYhzJ7VM2+ktSk7vL0zVwFHq1gTDaYdfWTAeQERHXVhnfBdjg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756044521; c=relaxed/simple; bh=aftj3TKHvQJpsNz4ejokh3Ox+fhGocTBQ5CCibzotPc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RYA1aeK4kGeayT+QE4ZgiiiIwCdDKIqAupQ1Fn0RmneTfsHBEqY1TdsCG/dtxlKPCaXd+XgTu4fQMQxZ2EP3y5Gd5OUkuvJRPR4kpeHsAb+OjPAg+SlGlrYQlVHXVRuFOXdecsYeBknkqeFBIEWfbGwU/Hy1NpgfFk6veBSPW1g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CsU45icQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CsU45icQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60744C4CEEB; Sun, 24 Aug 2025 14:08:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756044521; bh=aftj3TKHvQJpsNz4ejokh3Ox+fhGocTBQ5CCibzotPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CsU45icQPQsTYQzBigLxx9oUSoRyVC/iB/P+X72TsgEz8xSUJjmaxOFzPMtnu9F3Q +fwEyV4B8jzxt/iKmLTv5K4CBe9ormJL6NYR+y0USoVJBWrD3XHOum/VV4eZs0/Vwc guarZQNSi2S6JMf62VK14nyi2Ih0w/yMKo3C/PolA3OmYNXAEXygF0XypR+Ieg8U8i vRNjKtQJ0B1iI3oVrAXzPNKqZsekz3bO/AacyJexpVbTdZZ5L/qHg/WMSUV5Q3DUSm Vk8pRLElQt9M4RexvUFm14esCZAmdyQ+Xbin1+MhSL6s1Vw0sO1apF2DRKJQPBasSq sXqwykpdaPDgQ== From: Sasha Levin To: stable@vger.kernel.org Cc: Steven Rostedt , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Sasha Levin Subject: [PATCH 5.10.y 1/2] tracing: Remove unneeded goto out logic Date: Sun, 24 Aug 2025 10:08:37 -0400 Message-ID: <20250824140838.2935876-1-sashal@kernel.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <2025082332-jubilance-impotency-10c3@gregkh> References: <2025082332-jubilance-impotency-10c3@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Steven Rostedt [ Upstream commit c89504a703fb779052213add0e8ed642f4a4f1c8 ] Several places in the trace.c file there's a goto out where the out is simply a return. There's no reason to jump to the out label if it's not doing any more logic but simply returning from the function. Replace the goto outs with a return and remove the out labels. Cc: Masami Hiramatsu Cc: Mark Rutland Cc: Mathieu Desnoyers Cc: Andrew Morton Link: https://lore.kernel.org/20250801203857.538726745@kernel.org Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin --- kernel/trace/trace.c | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 42c38a26c801..e0f1a8a6d85b 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -1613,7 +1613,7 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf, ret = get_user(ch, ubuf++); if (ret) - goto out; + return ret; read++; cnt--; @@ -1627,7 +1627,7 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf, while (cnt && isspace(ch)) { ret = get_user(ch, ubuf++); if (ret) - goto out; + return ret; read++; cnt--; } @@ -1637,8 +1637,7 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf, /* only spaces were written */ if (isspace(ch) || !ch) { *ppos += read; - ret = read; - goto out; + return read; } } @@ -1646,13 +1645,12 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf, while (cnt && !isspace(ch) && ch) { if (parser->idx < parser->size - 1) parser->buffer[parser->idx++] = ch; - else { - ret = -EINVAL; - goto out; - } + else + return -EINVAL; + ret = get_user(ch, ubuf++); if (ret) - goto out; + return ret; read++; cnt--; } @@ -1667,15 +1665,11 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf, /* Make sure the parsed string always terminates with '\0'. */ parser->buffer[parser->idx] = 0; } else { - ret = -EINVAL; - goto out; + return -EINVAL; } *ppos += read; - ret = read; - -out: - return ret; + return read; } /* TODO add a seq_buf_to_buffer() */ @@ -2139,10 +2133,10 @@ int __init register_tracer(struct tracer *type) mutex_unlock(&trace_types_lock); if (ret || !default_bootup_tracer) - goto out_unlock; + return ret; if (strncmp(default_bootup_tracer, type->name, MAX_TRACER_SIZE)) - goto out_unlock; + return 0; printk(KERN_INFO "Starting tracer '%s'\n", type->name); /* Do we want this tracer to start on bootup? */ @@ -2154,8 +2148,7 @@ int __init register_tracer(struct tracer *type) /* disable other selftests, since this will break it. */ disable_tracing_selftest("running a tracer"); - out_unlock: - return ret; + return 0; } static void tracing_reset_cpu(struct array_buffer *buf, int cpu) @@ -8240,11 +8233,10 @@ ftrace_trace_snapshot_callback(struct trace_array *tr, struct ftrace_hash *hash, out_reg: ret = tracing_alloc_snapshot_instance(tr); if (ret < 0) - goto out; + return ret; ret = register_ftrace_function_probe(glob, tr, ops, count); - out: return ret < 0 ? ret : 0; } @@ -9746,7 +9738,7 @@ __init static int tracer_alloc_buffers(void) BUILD_BUG_ON(TRACE_ITER_LAST_BIT > TRACE_FLAGS_MAX_SIZE); if (!alloc_cpumask_var(&tracing_buffer_mask, GFP_KERNEL)) - goto out; + return -ENOMEM; if (!alloc_cpumask_var(&global_trace.tracing_cpumask, GFP_KERNEL)) goto out_free_buffer_mask; @@ -9857,7 +9849,6 @@ __init static int tracer_alloc_buffers(void) free_cpumask_var(global_trace.tracing_cpumask); out_free_buffer_mask: free_cpumask_var(tracing_buffer_mask); -out: return ret; } -- 2.50.1