diff options
author | Lucas Stach <l.stach@pengutronix.de> | 2020-09-11 10:32:52 +0200 |
---|---|---|
committer | Lucas Stach <l.stach@pengutronix.de> | 2020-09-30 17:33:18 +0200 |
commit | 2103c0556c27ffc19a9bfc0523218e7c319133fc (patch) | |
tree | e4408897c210f4da8ba61b280f2a3c314213fa16 | |
parent | ba4f184e126b751d1bffad5897f263108befc780 (diff) | |
download | linux-2103c0556c27ffc19a9bfc0523218e7c319133fc.tar.gz linux-2103c0556c27ffc19a9bfc0523218e7c319133fc.tar.xz |
soc: imx: gpcv2: move to more ideomatic error handling in probe
Switch to "goto out..." error handling in domain driver probe to
avoid repeating all the error paths.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-rw-r--r-- | drivers/soc/imx/gpcv2.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c index 6cf8a7a412bd..8f91ef2d24de 100644 --- a/drivers/soc/imx/gpcv2.c +++ b/drivers/soc/imx/gpcv2.c @@ -507,18 +507,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; } |