summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2019-04-18 13:27:55 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-04-25 10:37:28 +0300
commit71b77697af9ef06b559875e4bd8dc3d141807c93 (patch)
tree81af3940f41f6fe170b32c8fbc7a7acd9d0e3490 /drivers/base
parente757e7fa3a93afa54a1bf31953f458b0005e0910 (diff)
downloadlinux-71b77697af9ef06b559875e4bd8dc3d141807c93.tar.xz
PM / Domains: Don't kfree() the virtual device in the error path
It's not correct to call kfree(dev) when device_register(dev) has failed. Fix this by calling put_device(dev) instead. Fixes: 3c095f32a92b ("PM / Domains: Add support for multi PM domains per device to genpd") Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Niklas Cassel <niklas.cassel@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/domain.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 598a4e02aee1..5422fc01dca3 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2455,7 +2455,7 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev,
ret = device_register(virt_dev);
if (ret) {
- kfree(virt_dev);
+ put_device(virt_dev);
return ERR_PTR(ret);
}