diff options
| author | Johan Hovold <johan@kernel.org> | 2026-05-11 18:04:03 +0300 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-05-18 12:19:47 +0300 |
| commit | 0a290bb1ff0b11998db2b36c8ebcca4913ccacb7 (patch) | |
| tree | e7e35ca859ad2bcc7ed1f74802a9a62815f6d17a | |
| parent | 572a9fb1a6098170b669681e8444e8516a95b8c3 (diff) | |
| download | linux-0a290bb1ff0b11998db2b36c8ebcca4913ccacb7.tar.xz | |
spi: jcore: 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-8-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | drivers/spi/spi-jcore.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/drivers/spi/spi-jcore.c b/drivers/spi/spi-jcore.c index e37ca22e04ba..a75cd61ec7a3 100644 --- a/drivers/spi/spi-jcore.c +++ b/drivers/spi/spi-jcore.c @@ -146,11 +146,10 @@ static int jcore_spi_probe(struct platform_device *pdev) struct resource *res; u32 clock_freq; struct clk *clk; - int err = -ENODEV; - host = spi_alloc_host(&pdev->dev, sizeof(struct jcore_spi)); + host = devm_spi_alloc_host(&pdev->dev, sizeof(struct jcore_spi)); if (!host) - return err; + return -ENOMEM; /* Setup the host state. */ host->num_chipselect = 3; @@ -167,14 +166,14 @@ static int jcore_spi_probe(struct platform_device *pdev) /* Find and map our resources */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) - goto exit_busy; + return -EBUSY; if (!devm_request_mem_region(&pdev->dev, res->start, resource_size(res), pdev->name)) - goto exit_busy; + return -EBUSY; hw->base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); if (!hw->base) - goto exit_busy; + return -EBUSY; /* * The SPI clock rate controlled via a configurable clock divider @@ -200,17 +199,7 @@ static int jcore_spi_probe(struct platform_device *pdev) jcore_spi_baudrate(hw, 400000); /* Register our spi controller */ - err = devm_spi_register_controller(&pdev->dev, host); - if (err) - goto exit; - - return 0; - -exit_busy: - err = -EBUSY; -exit: - spi_controller_put(host); - return err; + return devm_spi_register_controller(&pdev->dev, host); } static const struct of_device_id jcore_spi_of_match[] = { |
