From: Viresh Kumar Date: Mon, 11 Jan 2016 05:59:05 +0000 (+0530) Subject: greybus: arche-platform: Put APB in reset if of_platform_populate() fails X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=72a8c24b6dcae46c4e8c37c1b1d1adb6e6b8a72f;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git greybus: arche-platform: Put APB in reset if of_platform_populate() fails The current implementation around of_platform_populate() is not so great. On error, we first print an error message, followed by a success message and finally we return an error. And over that we don't undo what we did initially. This patch puts the APB back into reset and create a separate error path to make things clear. Signed-off-by: Viresh Kumar Reviewed-by: Vaibhav Hiremath Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c index 93d90b2dc866..67bbd71ec3d1 100644 --- a/drivers/staging/greybus/arche-platform.c +++ b/drivers/staging/greybus/arche-platform.c @@ -156,13 +156,16 @@ static int arche_platform_probe(struct platform_device *pdev) /* probe all childs here */ ret = of_platform_populate(np, NULL, NULL, dev); - if (ret) + if (ret) { + arche_platform_cleanup(arche_pdata); dev_err(dev, "no child node found\n"); + return ret; + } export_gpios(arche_pdata); dev_info(dev, "Device registered successfully\n"); - return ret; + return 0; } static int arche_remove_child(struct device *dev, void *unused)