Commit c61088d1 authored by Vignesh Raghavendra's avatar Vignesh Raghavendra Committed by Mark Brown

mtd: spi-nor: cadence-quadspi: Fix error path on failure to acquire reset lines

Make sure to undo the prior changes done by the driver when exiting due
to failure to acquire reset lines.
Signed-off-by: default avatarVignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
Acked-by: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/r/20200601070444.16923-5-vigneshr@ti.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 48aae57f
...@@ -1359,13 +1359,13 @@ static int cqspi_probe(struct platform_device *pdev) ...@@ -1359,13 +1359,13 @@ static int cqspi_probe(struct platform_device *pdev)
rstc = devm_reset_control_get_optional_exclusive(dev, "qspi"); rstc = devm_reset_control_get_optional_exclusive(dev, "qspi");
if (IS_ERR(rstc)) { if (IS_ERR(rstc)) {
dev_err(dev, "Cannot get QSPI reset.\n"); dev_err(dev, "Cannot get QSPI reset.\n");
return PTR_ERR(rstc); goto probe_reset_failed;
} }
rstc_ocp = devm_reset_control_get_optional_exclusive(dev, "qspi-ocp"); rstc_ocp = devm_reset_control_get_optional_exclusive(dev, "qspi-ocp");
if (IS_ERR(rstc_ocp)) { if (IS_ERR(rstc_ocp)) {
dev_err(dev, "Cannot get QSPI OCP reset.\n"); dev_err(dev, "Cannot get QSPI OCP reset.\n");
return PTR_ERR(rstc_ocp); goto probe_reset_failed;
} }
reset_control_assert(rstc); reset_control_assert(rstc);
...@@ -1384,7 +1384,7 @@ static int cqspi_probe(struct platform_device *pdev) ...@@ -1384,7 +1384,7 @@ static int cqspi_probe(struct platform_device *pdev)
pdev->name, cqspi); pdev->name, cqspi);
if (ret) { if (ret) {
dev_err(dev, "Cannot request IRQ.\n"); dev_err(dev, "Cannot request IRQ.\n");
goto probe_irq_failed; goto probe_reset_failed;
} }
cqspi_wait_idle(cqspi); cqspi_wait_idle(cqspi);
...@@ -1401,7 +1401,7 @@ static int cqspi_probe(struct platform_device *pdev) ...@@ -1401,7 +1401,7 @@ static int cqspi_probe(struct platform_device *pdev)
return ret; return ret;
probe_setup_failed: probe_setup_failed:
cqspi_controller_enable(cqspi, 0); cqspi_controller_enable(cqspi, 0);
probe_irq_failed: probe_reset_failed:
clk_disable_unprepare(cqspi->clk); clk_disable_unprepare(cqspi->clk);
probe_clk_failed: probe_clk_failed:
pm_runtime_put_sync(dev); pm_runtime_put_sync(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment