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

yang_yongxin123@163.com posted 1 patch 1 month ago
kernel/profile.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] perf/profile: Remove unused local variable err
Posted by yang_yongxin123@163.com 1 month ago
From: Yongxin Yang <yangyongxin@kylinos.cn>

Variable err is declared but never used in this function.
Remove it to avoid compiler warning.

No functional change.

Signed-off-by: Yongxin Yang <yangyongxin@kylinos.cn>
---
 kernel/profile.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/profile.c b/kernel/profile.c
index 1fcf1adcf4eb..6f63e3a8d3fb 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -216,7 +216,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;
@@ -224,7 +223,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
Re: [PATCH] perf/profile: Remove unused local variable err
Posted by Bradley Morgan 1 month ago
On 24 August 2026 03:42:51 BST, yang_yongxin123@163.com wrote:
>From: Yongxin Yang <yangyongxin@kylinos.cn>
>
>Variable err is declared but never used in this function.
>Remove it to avoid compiler warning.
>
>No functional change.
>

Obviously correct

Reviewed-by: Bradley Morgan <include@grrlz.net>



>Signed-off-by: Yongxin Yang <yangyongxin@kylinos.cn>
>---
> kernel/profile.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
>diff --git a/kernel/profile.c b/kernel/profile.c
>index 1fcf1adcf4eb..6f63e3a8d3fb 100644
>--- a/kernel/profile.c
>+++ b/kernel/profile.c
>@@ -216,7 +216,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;
>@@ -224,7 +223,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 */
>

Thanks!