[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210510040045.13225-2-peng.fan@oss.nxp.com>
Date: Mon, 10 May 2021 12:00:33 +0800
From: "Peng Fan (OSS)" <peng.fan@....nxp.com>
To: robh+dt@...nel.org, shawnguo@...nel.org, s.hauer@...gutronix.de
Cc: kernel@...gutronix.de, festevam@...il.com, linux-imx@....com,
p.zabel@...gutronix.de, l.stach@...gutronix.de, krzk@...nel.org,
agx@...xcpu.org, marex@...x.de, andrew.smirnov@...il.com,
devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, ping.bai@....com,
frieder.schrempf@...tron.de, aford173@...il.com, abel.vesa@....com,
Peng Fan <peng.fan@....com>
Subject: [PATCH V3 01/13] soc: imx: gpcv2: move to more ideomatic error handling in probe
From: Lucas Stach <l.stach@...gutronix.de>
Switch to "goto out..." error handling in domain driver probe to
avoid repeating all the error paths.
Tested-by: Frieder Schrempf <frieder.schrempf@...tron.de>
Reviewed-by: Marek Vasut <marex@...x.de>
Reviewed-by: Frieder Schrempf <frieder.schrempf@...tron.de>
Tested-by: Adam Ford <aford173@...il.com>
Signed-off-by: Lucas Stach <l.stach@...gutronix.de>
Signed-off-by: Peng Fan <peng.fan@....com>
---
drivers/soc/imx/gpcv2.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c
index db7e7fc321b1..512e6f4acafd 100644
--- a/drivers/soc/imx/gpcv2.c
+++ b/drivers/soc/imx/gpcv2.c
@@ -502,18 +502,23 @@ static int imx_pgc_domain_probe(struct platform_device *pdev)
ret = pm_genpd_init(&domain->genpd, NULL, true);
if (ret) {
dev_err(domain->dev, "Failed to init power domain\n");
- imx_pgc_put_clocks(domain);
- return ret;
+ goto out_put_clocks;
}
ret = of_genpd_add_provider_simple(domain->dev->of_node,
&domain->genpd);
if (ret) {
dev_err(domain->dev, "Failed to add genpd provider\n");
- pm_genpd_remove(&domain->genpd);
- imx_pgc_put_clocks(domain);
+ goto out_genpd_remove;
}
+ return 0;
+
+out_genpd_remove:
+ pm_genpd_remove(&domain->genpd);
+out_put_clocks:
+ imx_pgc_put_clocks(domain);
+
return ret;
}
--
2.30.0
Powered by blists - more mailing lists