summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2026-05-11 17:04:06 +0200
committerMark Brown <broonie@kernel.org>2026-05-18 10:19:50 +0100
commit1e447a5aa12443410da74b4bbf2ae922ca63ef4e (patch)
tree31e56a849fe704af3c744c617702ce8770784bd7
parent4fee1d3a563d2fd6eee8434adde0af10cd7db2ae (diff)
spi: meson-spifc: switch to managed controller allocation
Switch to device managed controller allocation for consistency and to simplify error handling. Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260511150408.796155-11-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-meson-spifc.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/spi/spi-meson-spifc.c b/drivers/spi/spi-meson-spifc.c
index b818950a8cb7..d700fa315223 100644
--- a/drivers/spi/spi-meson-spifc.c
+++ b/drivers/spi/spi-meson-spifc.c
@@ -288,9 +288,9 @@ static int meson_spifc_probe(struct platform_device *pdev)
struct meson_spifc *spifc;
void __iomem *base;
unsigned int rate;
- int ret = 0;
+ int ret;
- host = spi_alloc_host(&pdev->dev, sizeof(struct meson_spifc));
+ host = devm_spi_alloc_host(&pdev->dev, sizeof(struct meson_spifc));
if (!host)
return -ENOMEM;
@@ -300,23 +300,18 @@ static int meson_spifc_probe(struct platform_device *pdev)
spifc->dev = &pdev->dev;
base = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(base)) {
- ret = PTR_ERR(base);
- goto out_err;
- }
+ if (IS_ERR(base))
+ return PTR_ERR(base);
spifc->regmap = devm_regmap_init_mmio(spifc->dev, base,
&spifc_regmap_config);
- if (IS_ERR(spifc->regmap)) {
- ret = PTR_ERR(spifc->regmap);
- goto out_err;
- }
+ if (IS_ERR(spifc->regmap))
+ return PTR_ERR(spifc->regmap);
spifc->clk = devm_clk_get_enabled(spifc->dev, NULL);
if (IS_ERR(spifc->clk)) {
dev_err(spifc->dev, "missing clock\n");
- ret = PTR_ERR(spifc->clk);
- goto out_err;
+ return PTR_ERR(spifc->clk);
}
rate = clk_get_rate(spifc->clk);
@@ -342,8 +337,7 @@ static int meson_spifc_probe(struct platform_device *pdev)
return 0;
out_pm:
pm_runtime_disable(spifc->dev);
-out_err:
- spi_controller_put(host);
+
return ret;
}