diff mbox series

[v2] cpufreq: stats: Clean up local variable of cpufreq_stats_create_table

Message ID 1622445367-37754-1-git-send-email-zhangshaokun@hisilicon.com (mailing list archive)
State Awaiting Upstream
Delegated to: Rafael Wysocki
Headers show
Series [v2] cpufreq: stats: Clean up local variable of cpufreq_stats_create_table | expand

Commit Message

Shaokun Zhang May 31, 2021, 7:16 a.m. UTC
Local variable 'count' will be initialized and 'ret' also is not required,
so remove the redundant initialization and get rid of 'ret'.

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
---
ChangeLog:
v1-->v2:
    1. Address Viresh's comment, get rid of 'ret'

 drivers/cpufreq/cpufreq_stats.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Viresh Kumar May 31, 2021, 7:19 a.m. UTC | #1
On 31-05-21, 15:16, Shaokun Zhang wrote:
> Local variable 'count' will be initialized and 'ret' also is not required,
> so remove the redundant initialization and get rid of 'ret'.
> 
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
> ---
> ChangeLog:
> v1-->v2:
>     1. Address Viresh's comment, get rid of 'ret'
> 
>  drivers/cpufreq/cpufreq_stats.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Rafael J. Wysocki May 31, 2021, 12:11 p.m. UTC | #2
On Mon, May 31, 2021 at 9:19 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> On 31-05-21, 15:16, Shaokun Zhang wrote:
> > Local variable 'count' will be initialized and 'ret' also is not required,
> > so remove the redundant initialization and get rid of 'ret'.
> >
> > Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> > Cc: Viresh Kumar <viresh.kumar@linaro.org>
> > Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
> > ---
> > ChangeLog:
> > v1-->v2:
> >     1. Address Viresh's comment, get rid of 'ret'
> >
> >  drivers/cpufreq/cpufreq_stats.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Applied as 5.14 material, thanks!
diff mbox series

Patch

diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index da717f7cd9a9..1570d6f3e75d 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -211,7 +211,7 @@  void cpufreq_stats_free_table(struct cpufreq_policy *policy)
 
 void cpufreq_stats_create_table(struct cpufreq_policy *policy)
 {
-	unsigned int i = 0, count = 0, ret = -ENOMEM;
+	unsigned int i = 0, count;
 	struct cpufreq_stats *stats;
 	unsigned int alloc_size;
 	struct cpufreq_frequency_table *pos;
@@ -253,8 +253,7 @@  void cpufreq_stats_create_table(struct cpufreq_policy *policy)
 	stats->last_index = freq_table_get_index(stats, policy->cur);
 
 	policy->stats = stats;
-	ret = sysfs_create_group(&policy->kobj, &stats_attr_group);
-	if (!ret)
+	if (!sysfs_create_group(&policy->kobj, &stats_attr_group))
 		return;
 
 	/* We failed, release resources */