greybus: arche-platform: Export GPIOs after populating APBs
authorViresh Kumar <viresh.kumar@linaro.org>
Mon, 11 Jan 2016 05:59:04 +0000 (11:29 +0530)
committerGreg Kroah-Hartman <gregkh@google.com>
Mon, 11 Jan 2016 23:58:01 +0000 (15:58 -0800)
Populating APBs operation can potentially fail and it would be better if
we export the GPIOs towards then end of the routine, so that we don't
need to unexport them on error cases.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/arche-platform.c

index 259473cd506dd0f0d131313815ba146409862713..93d90b2dc866bd7d752538073bd3981fd51d97c3 100644 (file)
@@ -154,13 +154,13 @@ static int arche_platform_probe(struct platform_device *pdev)
        arche_pdata->num_apbs = of_get_child_count(np);
        dev_dbg(dev, "Number of APB's available - %d\n", arche_pdata->num_apbs);
 
-       export_gpios(arche_pdata);
-
        /* probe all childs here */
        ret = of_platform_populate(np, NULL, NULL, dev);
        if (ret)
                dev_err(dev, "no child node found\n");
 
+       export_gpios(arche_pdata);
+
        dev_info(dev, "Device registered successfully\n");
        return ret;
 }