@@ -408,7 +408,7 @@ static struct genpd_onecell_data imx_gpc_onecell_data = {
static int imx_gpc_genpd_init(struct device *dev, struct regulator *pu_reg)
{
struct clk *clk;
- int i;
+ int i, ret;
imx6q_pu_domain.reg = pu_reg;
@@ -432,12 +432,20 @@ static int imx_gpc_genpd_init(struct device
*dev, struct regulator *pu_reg)
for (i = 0; i < ARRAY_SIZE(imx_gpc_domains); i++)
pm_genpd_init(imx_gpc_domains[i], NULL, false);
- return of_genpd_add_provider_onecell(dev->of_node,
+
+ ret = of_genpd_add_provider_onecell(dev->of_node,
&imx_gpc_onecell_data);
+ if (ret)
+ goto power_off;
+
+ return 0;
+power_off:
+ imx6q_pm_pu_power_off(&imx6q_pu_domain.base);
clk_err:
while (i--)
clk_put(imx6q_pu_domain.clk[i]);
+ imx6q_pu_domain.reg = NULL;
return -EINVAL;
}
Or we can not even try to boot the kernel:
Option 2:
@@ -459,7 +459,13 @@ static int imx_gpc_probe(struct platform_device *pdev)
return ret;
}
- return imx_gpc_genpd_init(&pdev->dev, pu_reg);
+ ret = imx_gpc_genpd_init(&pdev->dev, pu_reg);
+ /*
+ * If imx_gpc_probe() fails we should better not continue
+ * to boot as the SoC may be in an impredictable state
+ */
+ BUG_ON(ret);
+ return ret;
}
I am more inclined towards option 2, but would like to get some feedback first.