linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] cpufreq: stats: Clean up local variable of cpufreq_stats_create_table
@ 2021-05-31  7:16 Shaokun Zhang
  2021-05-31  7:19 ` Viresh Kumar
  0 siblings, 1 reply; 3+ messages in thread
From: Shaokun Zhang @ 2021-05-31  7:16 UTC (permalink / raw)
  To: linux-pm; +Cc: Shaokun Zhang, Rafael J. Wysocki, Viresh Kumar

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(-)

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 */
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] cpufreq: stats: Clean up local variable of cpufreq_stats_create_table
  2021-05-31  7:16 [PATCH v2] cpufreq: stats: Clean up local variable of cpufreq_stats_create_table Shaokun Zhang
@ 2021-05-31  7:19 ` Viresh Kumar
  2021-05-31 12:11   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2021-05-31  7:19 UTC (permalink / raw)
  To: Shaokun Zhang; +Cc: linux-pm, Rafael J. Wysocki

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>

-- 
viresh

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] cpufreq: stats: Clean up local variable of cpufreq_stats_create_table
  2021-05-31  7:19 ` Viresh Kumar
@ 2021-05-31 12:11   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2021-05-31 12:11 UTC (permalink / raw)
  To: Viresh Kumar, Shaokun Zhang; +Cc: Linux PM, Rafael J. Wysocki

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!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-31 12:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31  7:16 [PATCH v2] cpufreq: stats: Clean up local variable of cpufreq_stats_create_table Shaokun Zhang
2021-05-31  7:19 ` Viresh Kumar
2021-05-31 12:11   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).