mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
spi: nxp-fspi: disable runtime PM on probe failures
nxp_fspi_probe() enables runtime PM and autosuspend before several operations that can fail. Some failure paths returned directly before the devm cleanup action was installed, leaving runtime PM enabled. Route those failures through a common runtime PM cleanup path. Use pm_runtime_resume_and_get() for the initial clock enable. Signed-off-by: Jiawen Liu <1298662399@qq.com> Link: https://patch.msgid.link/tencent_8FC0B8DFAF4AE67AEBA20548045D53A77707@qq.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
2543355f3d
commit
5d14285d60
|
|
@ -1350,9 +1350,11 @@ static int nxp_fspi_probe(struct platform_device *pdev)
|
|||
pm_runtime_use_autosuspend(dev);
|
||||
|
||||
/* enable clock */
|
||||
ret = pm_runtime_get_sync(f->dev);
|
||||
if (ret < 0)
|
||||
return dev_err_probe(dev, ret, "Failed to enable clock");
|
||||
ret = pm_runtime_resume_and_get(f->dev);
|
||||
if (ret < 0) {
|
||||
ret = dev_err_probe(dev, ret, "Failed to enable clock");
|
||||
goto err_disable_pm;
|
||||
}
|
||||
|
||||
/* Clear potential interrupts */
|
||||
reg = fspi_readl(f, f->iobase + FSPI_INTR);
|
||||
|
|
@ -1362,18 +1364,24 @@ static int nxp_fspi_probe(struct platform_device *pdev)
|
|||
nxp_fspi_default_setup(f);
|
||||
|
||||
ret = pm_runtime_put_sync(dev);
|
||||
if (ret < 0)
|
||||
return dev_err_probe(dev, ret, "Failed to disable clock");
|
||||
if (ret < 0) {
|
||||
ret = dev_err_probe(dev, ret, "Failed to disable clock");
|
||||
goto err_disable_pm;
|
||||
}
|
||||
|
||||
init_completion(&f->c);
|
||||
ret = devm_request_irq(dev, irq,
|
||||
nxp_fspi_irq_handler, 0, pdev->name, f);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "Failed to request irq\n");
|
||||
if (ret) {
|
||||
ret = dev_err_probe(dev, ret, "Failed to request irq\n");
|
||||
goto err_disable_pm;
|
||||
}
|
||||
|
||||
ret = devm_mutex_init(dev, &f->lock);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "Failed to initialize lock\n");
|
||||
if (ret) {
|
||||
ret = dev_err_probe(dev, ret, "Failed to initialize lock\n");
|
||||
goto err_disable_pm;
|
||||
}
|
||||
|
||||
ctlr->bus_num = -1;
|
||||
ctlr->num_chipselect = NXP_FSPI_MAX_CHIPSELECT;
|
||||
|
|
@ -1389,6 +1397,11 @@ static int nxp_fspi_probe(struct platform_device *pdev)
|
|||
return ret;
|
||||
|
||||
return devm_spi_register_controller(&pdev->dev, ctlr);
|
||||
|
||||
err_disable_pm:
|
||||
pm_runtime_dont_use_autosuspend(dev);
|
||||
pm_runtime_disable(dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int nxp_fspi_runtime_suspend(struct device *dev)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user