summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/arche-platform.c
diff options
context:
space:
mode:
authorVaibhav Hiremath2016-02-24 21:57:36 +0100
committerGreg Kroah-Hartman2016-02-25 02:36:16 +0100
commit6743a6fd963aba000b128fd0b5c420a8f4b0dcde (patch)
treed4b0a499295382052cb80fb87a028ffba54e8976 /drivers/staging/greybus/arche-platform.c
parentgreybus: uart: fix incomplete receive-data sanity checks (diff)
downloadkernel-qcow2-linux-6743a6fd963aba000b128fd0b5c420a8f4b0dcde.tar.gz
kernel-qcow2-linux-6743a6fd963aba000b128fd0b5c420a8f4b0dcde.tar.xz
kernel-qcow2-linux-6743a6fd963aba000b128fd0b5c420a8f4b0dcde.zip
greybus: arche-platform: Fix exit path in probe fn
If SVC coldboot fails or if of_platform_populate() fn fails, then state of device needs to be reverted. Importantly, if of_platform_populate() fails, then poweroff the SVC. Testing Done: Tested on DB3.5 platform. Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> Reviewed-by: Michael Scott <michael.scott@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/arche-platform.c')
-rw-r--r--drivers/staging/greybus/arche-platform.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c
index efeafb373cf1..c99a375bbafb 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -387,13 +387,13 @@ static int arche_platform_probe(struct platform_device *pdev)
ret = arche_platform_coldboot_seq(arche_pdata);
if (ret) {
dev_err(dev, "Failed to cold boot svc %d\n", ret);
- return ret;
+ goto err_coldboot;
}
ret = of_platform_populate(np, NULL, NULL, dev);
if (ret) {
dev_err(dev, "failed to populate child nodes %d\n", ret);
- return ret;
+ goto err_populate;
}
INIT_DELAYED_WORK(&arche_pdata->delayed_work, svc_delayed_work);
@@ -401,6 +401,12 @@ static int arche_platform_probe(struct platform_device *pdev)
dev_info(dev, "Device registered successfully\n");
return 0;
+
+err_populate:
+ arche_platform_poweroff_seq(arche_pdata);
+err_coldboot:
+ device_remove_file(&pdev->dev, &dev_attr_state);
+ return ret;
}
static int arche_remove_child(struct device *dev, void *unused)