Align the behvaior to how other buses are handling attachment of PM
domains. Additionally, let's add error handling.

Signed-off-by: Ulf Hansson <[email protected]>
---
 drivers/mmc/core/sdio_bus.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index 65cf7a7..ba97779 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -313,13 +313,19 @@ int sdio_add_func(struct sdio_func *func)
        dev_set_name(&func->dev, "%s:%d", mmc_card_id(func->card), func->num);
 
        sdio_acpi_set_handle(func);
+
+       ret = dev_pm_domain_attach(&func->dev, false);
+       if (ret)
+               return ret;
+
        ret = device_add(&func->dev);
-       if (ret == 0) {
-               sdio_func_set_present(func);
-               dev_pm_domain_attach(&func->dev, false);
+       if (ret) {
+               dev_pm_domain_detach(&func->dev, false);
+               return ret;
        }
 
-       return ret;
+       sdio_func_set_present(func);
+       return 0;
 }
 
 /*
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to