Message ID | 20190829144815.686-1-ulf.hansson@linaro.org |
---|---|
State | Accepted |
Commit | 3ea4ca9267cf5d02149f7d8a11d8b4c82723a668 |
Headers | show |
Series | [1/2] PM / Domains: Simplify genpd_lookup_dev() | expand |
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 27592b73061d..2650ae2f46fd 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -380,8 +380,8 @@ int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state) unsigned int prev; int ret; - genpd = dev_to_genpd(dev); - if (IS_ERR(genpd)) + genpd = dev_to_genpd_safe(dev); + if (!genpd) return -ENODEV; if (unlikely(!genpd->set_performance_state))
The dev_pm_genpd_set_performance_state() could in principle be called for a device that has a different PM domain type attached than a genpd. This would lead to a problem as dev_to_genpd() uses the container_of macro. Address this problem by using dev_to_genpd_safe() instead. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> --- drivers/base/power/domain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1