mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 01:32:21 +02:00
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:
parent
0a290bb1ff
commit
06ba67d9d4
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user