summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>2022-04-07 14:44:25 +0300
committerMark Brown <broonie@kernel.org>2022-04-19 18:32:10 +0300
commit5088b3136439896c2858173402f32dada4db69f6 (patch)
tree47a3fc7fbe7fde52e2d4af5f701e0c426ac0ea85 /drivers/spi
parent5dee8bb8d14dc7536cec58cc1d94148dce89dfc5 (diff)
downloadlinux-5088b3136439896c2858173402f32dada4db69f6.tar.xz
spi: mt65xx: Move pm_runtime_enable() call to remove all gotos
The last goto in the probe function can be removed by calling pm_runtime_enable() right before devm_spi_register_master(), as only some init checks were being performed after enabling pm. This is a cleanup and brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20220407114428.167091-6-angelogioacchino.delregno@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-mt65xx.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
index a2daba3bba91..3f307b25433d 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -1224,22 +1224,18 @@ static int mtk_spi_probe(struct platform_device *pdev)
clk_disable_unprepare(mdata->spi_hclk);
}
- pm_runtime_enable(dev);
-
if (mdata->dev_comp->need_pad_sel) {
if (mdata->pad_num != master->num_chipselect) {
dev_err(dev,
"pad_num does not match num_chipselect(%d != %d)\n",
mdata->pad_num, master->num_chipselect);
- ret = -EINVAL;
- goto err_disable_runtime_pm;
+ return -EINVAL;
}
if (!master->cs_gpiods && master->num_chipselect > 1) {
dev_err(dev,
"cs_gpios not specified and num_chipselect > 1\n");
- ret = -EINVAL;
- goto err_disable_runtime_pm;
+ return -EINVAL;
}
}
@@ -1252,18 +1248,16 @@ static int mtk_spi_probe(struct platform_device *pdev)
dev_notice(dev, "SPI dma_set_mask(%d) failed, ret:%d\n",
addr_bits, ret);
+ pm_runtime_enable(dev);
+
ret = devm_spi_register_master(dev, master);
if (ret) {
+ pm_runtime_disable(dev);
dev_err(dev, "failed to register master (%d)\n", ret);
- goto err_disable_runtime_pm;
+ return ret;
}
return 0;
-
-err_disable_runtime_pm:
- pm_runtime_disable(dev);
-
- return ret;
}
static int mtk_spi_remove(struct platform_device *pdev)