summaryrefslogtreecommitdiff
path: root/drivers/memory/atmel-ebi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/memory/atmel-ebi.c')
-rw-r--r--drivers/memory/atmel-ebi.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
index cf6b404afaf1..2ab79d923139 100644
--- a/drivers/memory/atmel-ebi.c
+++ b/drivers/memory/atmel-ebi.c
@@ -561,7 +561,7 @@ static int atmel_ebi_probe(struct platform_device *pdev)
}
ret = clk_prepare_enable(ebi->smc.clk);
if (ret)
- return ret;
+ goto err_put_clk;
/*
* The sama5d3 does not provide an EBICSA register and thus does need
@@ -571,14 +571,16 @@ static int atmel_ebi_probe(struct platform_device *pdev)
ebi->regmap =
syscon_regmap_lookup_by_phandle(np,
ebi->caps->regmap_name);
- if (IS_ERR(ebi->regmap))
- return PTR_ERR(ebi->regmap);
+ if (IS_ERR(ebi->regmap)) {
+ ret = PTR_ERR(ebi->regmap);
+ goto err_disable_clk;
+ }
}
ret = of_property_read_u32(np, "#address-cells", &val);
if (ret) {
dev_err(dev, "missing #address-cells property\n");
- return ret;
+ goto err_disable_clk;
}
reg_cells = val;
@@ -586,7 +588,7 @@ static int atmel_ebi_probe(struct platform_device *pdev)
ret = of_property_read_u32(np, "#size-cells", &val);
if (ret) {
dev_err(dev, "missing #address-cells property\n");
- return ret;
+ goto err_disable_clk;
}
reg_cells += val;
@@ -602,11 +604,22 @@ static int atmel_ebi_probe(struct platform_device *pdev)
ret = atmel_ebi_dev_disable(ebi, child);
if (ret)
- return ret;
+ goto err_disable_clk;
}
}
- return of_platform_populate(np, NULL, NULL, dev);
+ ret = of_platform_populate(np, NULL, NULL, dev);
+ if (ret)
+ goto err_disable_clk;
+
+ return 0;
+
+err_disable_clk:
+ clk_disable_unprepare(ebi->smc.clk);
+err_put_clk:
+ clk_put(ebi->smc.clk);
+
+ return ret;
}
static __maybe_unused int atmel_ebi_resume(struct device *dev)