Skip to content

Commit

Permalink
cpufreq: governor: Free dbs_data directly when gov->init() fails
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Liao Chang authored and Rafael J. Wysocki committed Aug 29, 2023
1 parent 61bfbf7 commit 916f138
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/cpufreq/cpufreq_governor.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy)

ret = gov->init(dbs_data);
if (ret)
goto free_policy_dbs_info;
goto free_dbs_data;

/*
* The sampling interval should not be less than the transition latency
Expand Down Expand Up @@ -474,6 +474,8 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy)
if (!have_governor_per_policy())
gov->gdbs_data = NULL;
gov->exit(dbs_data);

free_dbs_data:
kfree(dbs_data);

free_policy_dbs_info:
Expand Down

0 comments on commit 916f138

Please sign in to comment.