diff options
| author | Johan Hovold <johan@kernel.org> | 2026-05-11 18:03:59 +0300 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-05-18 12:19:43 +0300 |
| commit | ee9575d2b3db1f3fde4563b6e52832dacc49d9c9 (patch) | |
| tree | 170cd6e6538e846ab8e99cc6488c28d092028f2e | |
| parent | 5b4a0450fe2f7912f34590721eb191010bf98dd3 (diff) | |
| download | linux-ee9575d2b3db1f3fde4563b6e52832dacc49d9c9.tar.xz | |
spi: clps711x: 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-4-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | drivers/spi/spi-clps711x.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c index d6458e59d41b..382c3c81c4b9 100644 --- a/drivers/spi/spi-clps711x.c +++ b/drivers/spi/spi-clps711x.c @@ -99,7 +99,7 @@ static int spi_clps711x_probe(struct platform_device *pdev) if (irq < 0) return irq; - host = spi_alloc_host(&pdev->dev, sizeof(*hw)); + host = devm_spi_alloc_host(&pdev->dev, sizeof(*hw)); if (!host) return -ENOMEM; @@ -113,22 +113,16 @@ static int spi_clps711x_probe(struct platform_device *pdev) hw = spi_controller_get_devdata(host); hw->spi_clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(hw->spi_clk)) { - ret = PTR_ERR(hw->spi_clk); - goto err_out; - } + if (IS_ERR(hw->spi_clk)) + return PTR_ERR(hw->spi_clk); hw->syscon = syscon_regmap_lookup_by_phandle(np, "syscon"); - if (IS_ERR(hw->syscon)) { - ret = PTR_ERR(hw->syscon); - goto err_out; - } + if (IS_ERR(hw->syscon)) + return PTR_ERR(hw->syscon); hw->syncio = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(hw->syncio)) { - ret = PTR_ERR(hw->syncio); - goto err_out; - } + if (IS_ERR(hw->syncio)) + return PTR_ERR(hw->syncio); /* Disable extended mode due hardware problems */ regmap_update_bits(hw->syscon, SYSCON_OFFSET, SYSCON3_ADCCON, 0); @@ -139,16 +133,9 @@ static int spi_clps711x_probe(struct platform_device *pdev) ret = devm_request_irq(&pdev->dev, irq, spi_clps711x_isr, 0, dev_name(&pdev->dev), host); if (ret) - goto err_out; + return ret; - ret = devm_spi_register_controller(&pdev->dev, host); - if (!ret) - return 0; - -err_out: - spi_controller_put(host); - - return ret; + return devm_spi_register_controller(&pdev->dev, host); } static const struct of_device_id clps711x_spi_dt_ids[] = { |
