Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Liao Chang and committed by
Rafael J. Wysocki
916f1388 61bfbf79

+3 -1
+3 -1
drivers/cpufreq/cpufreq_governor.c
··· 439 439 440 440 ret = gov->init(dbs_data); 441 441 if (ret) 442 - goto free_policy_dbs_info; 442 + goto free_dbs_data; 443 443 444 444 /* 445 445 * The sampling interval should not be less than the transition latency ··· 474 474 if (!have_governor_per_policy()) 475 475 gov->gdbs_data = NULL; 476 476 gov->exit(dbs_data); 477 + 478 + free_dbs_data: 477 479 kfree(dbs_data); 478 480 479 481 free_policy_dbs_info: