PM / Domains: Don't return -EEXIST at attach when PM domain exists
authorUlf Hansson <ulf.hansson@linaro.org>
Mon, 14 May 2018 14:52:37 +0000 (16:52 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 15 May 2018 08:02:51 +0000 (10:02 +0200)
As dev_pm_domain_attach() isn't the only way to assign PM domain pointers
to devices, clearly we must allow a device to have the pointer already
being assigned. For this reason, return 0 instead of -EEXIST.

Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Tested-by: Krzysztof Kozlowski <krzk@kernel.org>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/common.c

index 5e4b481595bd7be4ae334528c3f8c3a411874ad7..390868c2b392d57d50264862985dcf369d11a5d9 100644 (file)
@@ -106,7 +106,7 @@ int dev_pm_domain_attach(struct device *dev, bool power_on)
        int ret;
 
        if (dev->pm_domain)
-               return -EEXIST;
+               return 0;
 
        ret = acpi_dev_pm_attach(dev, power_on);
        if (!ret)