Message ID | 1622282079-52196-1-git-send-email-zhangshaokun@hisilicon.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | cpufreq: stats: Remove redundant initialization of local variable | expand |
On 29-05-21, 17:54, Shaokun Zhang wrote: > Local variable 'count' and 'ret' will be initialized, so remove the > redundant initialization. > > Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> > Cc: Viresh Kumar <viresh.kumar@linaro.org> > Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com> > --- > drivers/cpufreq/cpufreq_stats.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c > index da717f7cd9a9..2af6c5b43c43 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, ret; ret isn't really required at all, can you get rid of it and update the only user to something like this ? if (!sysfs_create_group(&policy->kobj, &stats_attr_group)) return;
Hi Viresh, On 2021/5/31 13:16, Viresh Kumar wrote: > On 29-05-21, 17:54, Shaokun Zhang wrote: >> Local variable 'count' and 'ret' will be initialized, so remove the >> redundant initialization. >> >> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> >> Cc: Viresh Kumar <viresh.kumar@linaro.org> >> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com> >> --- >> drivers/cpufreq/cpufreq_stats.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c >> index da717f7cd9a9..2af6c5b43c43 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, ret; > > ret isn't really required at all, can you get rid of it and update the only user > to something like this ? Will follow it in next version. Thanks, Shaokun > > if (!sysfs_create_group(&policy->kobj, &stats_attr_group)) > return; >
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index da717f7cd9a9..2af6c5b43c43 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, ret; struct cpufreq_stats *stats; unsigned int alloc_size; struct cpufreq_frequency_table *pos;
Local variable 'count' and 'ret' will be initialized, so remove the redundant initialization. Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Cc: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com> --- drivers/cpufreq/cpufreq_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)