[PATCH v2] perf/profile: Remove unused local variable err

From: Yongxin Yang

Date: Wed Nov 04 2026 - 02:19:53 EST


In create_proc_profile() the local variable err is only ever assigned 0 and
then returned, so it can never hold anything but 0. Drop it and return 0
directly.

No functional change.

Reviewed-by: Bradley Morgan <include@xxxxxxxxx>
Signed-off-by: Yongxin Yang <yangyongxin@xxxxxxxxxx>
---
Link: https://lore.kernel.org/all/20260824024251.279751-1-yang_yongxin123@xxxxxxx/

Changes in v2:
- Rebased onto current mainline; the file has moved 24 lines since v1.
- Reword the changelog: err is read by the return statement, so there is no
compiler warning to fix; the variable is simply always zero.
- Add Reviewed-by from Bradley Morgan, given on v1.

kernel/profile.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/profile.c b/kernel/profile.c
index 13be6fc9fd00..2d3bef69d3be 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -240,7 +240,6 @@ static const struct proc_ops profile_proc_ops = {
int __ref create_proc_profile(void)
{
struct proc_dir_entry *entry;
- int err = 0;

if (!prof_on)
return 0;
@@ -248,7 +247,7 @@ int __ref create_proc_profile(void)
NULL, &profile_proc_ops);
if (entry)
proc_set_size(entry, (1 + prof_len) * sizeof(atomic_t));
- return err;
+ return 0;
}
subsys_initcall(create_proc_profile);
#endif /* CONFIG_PROC_FS */
--
2.25.1