Skip to content

Commit 916f138

Browse files
Liao Changrafaeljw
authored andcommitted
cpufreq: governor: Free dbs_data directly when gov->init() fails
Due to the kobject embedded in the dbs_data doest not has a release() method yet, it needs to use kfree() to free dbs_data directly when governor fails to allocate the tunner field of dbs_data. Signed-off-by: Liao Chang <liaochang1@huawei.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 61bfbf7 commit 916f138

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/cpufreq/cpufreq_governor.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy)
439439

440440
ret = gov->init(dbs_data);
441441
if (ret)
442-
goto free_policy_dbs_info;
442+
goto free_dbs_data;
443443

444444
/*
445445
* The sampling interval should not be less than the transition latency
@@ -474,6 +474,8 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy)
474474
if (!have_governor_per_policy())
475475
gov->gdbs_data = NULL;
476476
gov->exit(dbs_data);
477+
478+
free_dbs_data:
477479
kfree(dbs_data);
478480

479481
free_policy_dbs_info:

0 commit comments

Comments
 (0)