driver core: Respect all error codes from dev_pm_domain_attach()
authorUlf Hansson <ulf.hansson@linaro.org>
Thu, 26 Apr 2018 08:53:06 +0000 (10:53 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 14 May 2018 20:58:45 +0000 (22:58 +0200)
The limitation of being able to check only for -EPROBE_DEFER from
dev_pm_domain_attach() has been removed. Hence let's respect all error
codes and bail out accordingly.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/platform.c

index 8075ddc70a17825f4aa39cc52e3ef82d48f31263..9460139d9b023876e57ef2b793ffcc0e103d2ee9 100644 (file)
@@ -572,17 +572,16 @@ static int platform_drv_probe(struct device *_dev)
                return ret;
 
        ret = dev_pm_domain_attach(_dev, true);
-       if (ret != -EPROBE_DEFER) {
-               if (drv->probe) {
-                       ret = drv->probe(dev);
-                       if (ret)
-                               dev_pm_domain_detach(_dev, true);
-               } else {
-                       /* don't fail if just dev_pm_domain_attach failed */
-                       ret = 0;
-               }
+       if (ret)
+               goto out;
+
+       if (drv->probe) {
+               ret = drv->probe(dev);
+               if (ret)
+                       dev_pm_domain_detach(_dev, true);
        }
 
+out:
        if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) {
                dev_warn(_dev, "probe deferral not supported\n");
                ret = -ENXIO;