mirror of
https://github.com/torvalds/linux.git
synced 2026-09-29 04:22:03 +02:00
spi: zynqmp-gqspi: Use devm_spi_alloc_host()
Use devm_spi_alloc_host() so that there's no need to call spi_controller_put() in the error path. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Acked-by: Michal Simek <michal.simek@amd.com> Link: https://patch.msgid.link/20240826121421.3384792-2-ruanjinjie@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
e3de1d8deb
commit
64640f6c97
|
|
@ -1224,7 +1224,7 @@ static int zynqmp_qspi_probe(struct platform_device *pdev)
|
||||||
u32 num_cs;
|
u32 num_cs;
|
||||||
const struct qspi_platform_data *p_data;
|
const struct qspi_platform_data *p_data;
|
||||||
|
|
||||||
ctlr = spi_alloc_host(&pdev->dev, sizeof(*xqspi));
|
ctlr = devm_spi_alloc_host(&pdev->dev, sizeof(*xqspi));
|
||||||
if (!ctlr)
|
if (!ctlr)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
@ -1238,29 +1238,25 @@ static int zynqmp_qspi_probe(struct platform_device *pdev)
|
||||||
xqspi->has_tapdelay = true;
|
xqspi->has_tapdelay = true;
|
||||||
|
|
||||||
xqspi->regs = devm_platform_ioremap_resource(pdev, 0);
|
xqspi->regs = devm_platform_ioremap_resource(pdev, 0);
|
||||||
if (IS_ERR(xqspi->regs)) {
|
if (IS_ERR(xqspi->regs))
|
||||||
ret = PTR_ERR(xqspi->regs);
|
return PTR_ERR(xqspi->regs);
|
||||||
goto remove_ctlr;
|
|
||||||
}
|
|
||||||
|
|
||||||
xqspi->pclk = devm_clk_get(&pdev->dev, "pclk");
|
xqspi->pclk = devm_clk_get(&pdev->dev, "pclk");
|
||||||
if (IS_ERR(xqspi->pclk)) {
|
if (IS_ERR(xqspi->pclk)) {
|
||||||
dev_err(dev, "pclk clock not found.\n");
|
dev_err(dev, "pclk clock not found.\n");
|
||||||
ret = PTR_ERR(xqspi->pclk);
|
return PTR_ERR(xqspi->pclk);
|
||||||
goto remove_ctlr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xqspi->refclk = devm_clk_get(&pdev->dev, "ref_clk");
|
xqspi->refclk = devm_clk_get(&pdev->dev, "ref_clk");
|
||||||
if (IS_ERR(xqspi->refclk)) {
|
if (IS_ERR(xqspi->refclk)) {
|
||||||
dev_err(dev, "ref_clk clock not found.\n");
|
dev_err(dev, "ref_clk clock not found.\n");
|
||||||
ret = PTR_ERR(xqspi->refclk);
|
return PTR_ERR(xqspi->refclk);
|
||||||
goto remove_ctlr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = clk_prepare_enable(xqspi->pclk);
|
ret = clk_prepare_enable(xqspi->pclk);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev, "Unable to enable APB clock.\n");
|
dev_err(dev, "Unable to enable APB clock.\n");
|
||||||
goto remove_ctlr;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = clk_prepare_enable(xqspi->refclk);
|
ret = clk_prepare_enable(xqspi->refclk);
|
||||||
|
|
@ -1346,8 +1342,6 @@ static int zynqmp_qspi_probe(struct platform_device *pdev)
|
||||||
clk_disable_unprepare(xqspi->refclk);
|
clk_disable_unprepare(xqspi->refclk);
|
||||||
clk_dis_pclk:
|
clk_dis_pclk:
|
||||||
clk_disable_unprepare(xqspi->pclk);
|
clk_disable_unprepare(xqspi->pclk);
|
||||||
remove_ctlr:
|
|
||||||
spi_controller_put(ctlr);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user