diff mbox series

[07/11] driver core: Respect all error codes from dev_pm_domain_attach()

Message ID 1524732790-2234-8-git-send-email-ulf.hansson@linaro.org
State Accepted
Commit 88a9769e609a7f3b762a2fe88555c5602758346b
Headers show
Series PM / Domains: Fixup error paths with dev_pm_domain_attach() | expand

Commit Message

Ulf Hansson April 26, 2018, 8:53 a.m. UTC
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.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

---
 drivers/base/platform.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

-- 
2.7.4

Comments

Tony Lindgren May 15, 2018, 12:54 a.m. UTC | #1
* Ulf Hansson <ulf.hansson@linaro.org> [180514 18:59]:
> On 14 May 2018 at 17:19, Tony Lindgren <tony@atomide.com> wrote:

> > Reverting for 8c123c14bbba ("driver core: Respect all error codes from

> > dev_pm_domain_attach()") fixes the issue for me.

> >

> > Sounds like something is missing, any ideas?

> 

> This should solve the problem:

> 

> https://patchwork.kernel.org/patch/10398597/


Thanks yeah that fixes it for me too.

Regards,

Tony
diff mbox series

Patch

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 8075ddc..9460139 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -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;