[PATCH 06/12] spi: hisi-sfc-v3xx: switch to managed controller allocation

From: Johan Hovold

Date: Mon May 11 2026 - 11:15:12 EST


Switch to device managed controller allocation for consistency and to
simplify error handling.

Signed-off-by: Johan Hovold <johan@xxxxxxxxxx>
---
drivers/spi/spi-hisi-sfc-v3xx.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/spi/spi-hisi-sfc-v3xx.c b/drivers/spi/spi-hisi-sfc-v3xx.c
index b2af2eed197f..eeeb86381862 100644
--- a/drivers/spi/spi-hisi-sfc-v3xx.c
+++ b/drivers/spi/spi-hisi-sfc-v3xx.c
@@ -436,7 +436,7 @@ static int hisi_sfc_v3xx_probe(struct platform_device *pdev)
u32 version, glb_config;
int ret;

- ctlr = spi_alloc_host(&pdev->dev, sizeof(*host));
+ ctlr = devm_spi_alloc_host(&pdev->dev, sizeof(*host));
if (!ctlr)
return -ENOMEM;

@@ -451,16 +451,12 @@ static int hisi_sfc_v3xx_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, host);

host->regbase = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(host->regbase)) {
- ret = PTR_ERR(host->regbase);
- goto err_put_host;
- }
+ if (IS_ERR(host->regbase))
+ return PTR_ERR(host->regbase);

host->irq = platform_get_irq_optional(pdev, 0);
- if (host->irq == -EPROBE_DEFER) {
- ret = -EPROBE_DEFER;
- goto err_put_host;
- }
+ if (host->irq == -EPROBE_DEFER)
+ return -EPROBE_DEFER;

hisi_sfc_v3xx_disable_int(host);

@@ -501,16 +497,12 @@ static int hisi_sfc_v3xx_probe(struct platform_device *pdev)

ret = devm_spi_register_controller(dev, ctlr);
if (ret)
- goto err_put_host;
+ return ret;

dev_info(&pdev->dev, "hw version 0x%x, %s mode.\n",
version, host->irq ? "irq" : "polling");

return 0;
-
-err_put_host:
- spi_controller_put(ctlr);
- return ret;
}

static const struct acpi_device_id hisi_sfc_v3xx_acpi_ids[] = {
--
2.53.0