* [PATCH] cpufreq: stats: Remove redundant initialization of local variable
@ 2021-05-29 9:54 Shaokun Zhang
2021-05-31 5:16 ` Viresh Kumar
0 siblings, 1 reply; 3+ messages in thread
From: Shaokun Zhang @ 2021-05-29 9:54 UTC (permalink / raw)
To: linux-pm; +Cc: Shaokun Zhang, Rafael J. Wysocki, Viresh Kumar
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;
struct cpufreq_stats *stats;
unsigned int alloc_size;
struct cpufreq_frequency_table *pos;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cpufreq: stats: Remove redundant initialization of local variable
2021-05-29 9:54 [PATCH] cpufreq: stats: Remove redundant initialization of local variable Shaokun Zhang
@ 2021-05-31 5:16 ` Viresh Kumar
2021-05-31 5:43 ` Shaokun Zhang
0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2021-05-31 5:16 UTC (permalink / raw)
To: Shaokun Zhang; +Cc: linux-pm, Rafael J. Wysocki
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;
--
viresh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cpufreq: stats: Remove redundant initialization of local variable
2021-05-31 5:16 ` Viresh Kumar
@ 2021-05-31 5:43 ` Shaokun Zhang
0 siblings, 0 replies; 3+ messages in thread
From: Shaokun Zhang @ 2021-05-31 5:43 UTC (permalink / raw)
To: Viresh Kumar; +Cc: linux-pm, Rafael J. Wysocki
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;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-31 5:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-29 9:54 [PATCH] cpufreq: stats: Remove redundant initialization of local variable Shaokun Zhang
2021-05-31 5:16 ` Viresh Kumar
2021-05-31 5:43 ` Shaokun Zhang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.