spi: lp8841-rtc: 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-9-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Johan Hovold 2026-05-11 17:04:04 +02:00 committed by Mark Brown
parent 0a290bb1ff
commit 06ba67d9d4
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -185,7 +185,7 @@ spi_lp8841_rtc_probe(struct platform_device *pdev)
struct spi_controller *host;
struct spi_lp8841_rtc *data;
host = spi_alloc_host(&pdev->dev, sizeof(*data));
host = devm_spi_alloc_host(&pdev->dev, sizeof(*data));
if (!host)
return -ENOMEM;
platform_set_drvdata(pdev, host);
@ -208,23 +208,17 @@ spi_lp8841_rtc_probe(struct platform_device *pdev)
ret = PTR_ERR_OR_ZERO(data->iomem);
if (ret) {
dev_err(&pdev->dev, "failed to get IO address\n");
goto err_put_host;
return ret;
}
/* register with the SPI framework */
ret = devm_spi_register_controller(&pdev->dev, host);
if (ret) {
dev_err(&pdev->dev, "cannot register spi host\n");
goto err_put_host;
return ret;
}
return ret;
err_put_host:
spi_controller_put(host);
return ret;
return 0;
}
MODULE_ALIAS("platform:" DRIVER_NAME);