Skip to content

Commit debe081

Browse files
jhbird.choi@samsung.comrafaeljw
authored andcommitted
PM / Domains: Fix memory leak on error path in pm_genpd_attach_cpuidle
If pm_genpd_attach_cpudidle failed we leak memory stored in 'cpu_data'. Signed-off-by: Jonghwan Choi <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 2978af5 commit debe081

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/base/power/domain.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1862,7 +1862,7 @@ int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state)
18621862
cpuidle_drv = cpuidle_driver_ref();
18631863
if (!cpuidle_drv) {
18641864
ret = -ENODEV;
1865-
goto out;
1865+
goto err_drv;
18661866
}
18671867
if (cpuidle_drv->state_count <= state) {
18681868
ret = -EINVAL;
@@ -1884,6 +1884,9 @@ int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state)
18841884

18851885
err:
18861886
cpuidle_driver_unref();
1887+
1888+
err_drv:
1889+
kfree(cpu_data);
18871890
goto out;
18881891
}
18891892

0 commit comments

Comments
 (0)