Skip to content

Commit

Permalink
mtd: spi-nor: cadence-quadspi: Fix error path on failure to acquire r…
Browse files Browse the repository at this point in the history
…eset lines

Make sure to undo the prior changes done by the driver when exiting due
to failure to acquire reset lines.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Acked-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/r/20200601070444.16923-5-vigneshr@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Vignesh Raghavendra authored and Mark Brown committed Jun 19, 2020
1 parent 48aae57 commit c61088d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/mtd/spi-nor/controllers/cadence-quadspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1359,13 +1359,13 @@ static int cqspi_probe(struct platform_device *pdev)
rstc = devm_reset_control_get_optional_exclusive(dev, "qspi");
if (IS_ERR(rstc)) {
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");
if (IS_ERR(rstc_ocp)) {
dev_err(dev, "Cannot get QSPI OCP reset.\n");
return PTR_ERR(rstc_ocp);
goto probe_reset_failed;
}

reset_control_assert(rstc);
Expand All @@ -1384,7 +1384,7 @@ static int cqspi_probe(struct platform_device *pdev)
pdev->name, cqspi);
if (ret) {
dev_err(dev, "Cannot request IRQ.\n");
goto probe_irq_failed;
goto probe_reset_failed;
}

cqspi_wait_idle(cqspi);
Expand All @@ -1401,7 +1401,7 @@ static int cqspi_probe(struct platform_device *pdev)
return ret;
probe_setup_failed:
cqspi_controller_enable(cqspi, 0);
probe_irq_failed:
probe_reset_failed:
clk_disable_unprepare(cqspi->clk);
probe_clk_failed:
pm_runtime_put_sync(dev);
Expand Down

0 comments on commit c61088d

Please sign in to comment.