diff options
author | Rob Herring <robh@kernel.org> | 2023-02-17 23:45:41 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-03-06 02:39:01 +0300 |
commit | 01602336524e170bf7fe745b29258a4d1cafa9dd (patch) | |
tree | 6d802d314b1799495b2fd65c3f80567c758f7720 /drivers/spi/spi-mpc512x-psc.c | |
parent | 04725901d9933b3134e6dee6b5bc1efb67f8d43f (diff) | |
download | linux-01602336524e170bf7fe745b29258a4d1cafa9dd.tar.xz |
spi: mpc5xxx-psc: Convert probe to use devres functions
Convert the mpc52xx-psc and mpc512x-psc drivers to use the managed
devres variants of functions in probe. Also use dev_err_probe() as
appropriate. With this, the error handling can be simplified.
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230217-dt-mpc5xxx-spi-v1-2-3be8602fce1e@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-mpc512x-psc.c')
-rw-r--r-- | drivers/spi/spi-mpc512x-psc.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c index 0b4d49ef84de..c6a610b82d4a 100644 --- a/drivers/spi/spi-mpc512x-psc.c +++ b/drivers/spi/spi-mpc512x-psc.c @@ -467,7 +467,7 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, void *tempp; struct clk *clk; - master = spi_alloc_master(dev, sizeof(*mps)); + master = devm_spi_alloc_master(dev, sizeof(*mps)); if (master == NULL) return -ENOMEM; @@ -486,28 +486,24 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, master->dev.of_node = dev->of_node; tempp = devm_ioremap(dev, regaddr, size); - if (!tempp) { - dev_err(dev, "could not ioremap I/O port range\n"); - ret = -EFAULT; - goto free_master; - } + if (!tempp) + return dev_err_probe(dev, -EFAULT, "could not ioremap I/O port range\n"); mps->psc = tempp; mps->fifo = (struct mpc512x_psc_fifo *)(tempp + sizeof(struct mpc52xx_psc)); ret = devm_request_irq(dev, mps->irq, mpc512x_psc_spi_isr, IRQF_SHARED, "mpc512x-psc-spi", mps); if (ret) - goto free_master; + return ret; init_completion(&mps->txisrdone); clk = devm_clk_get(dev, "mclk"); - if (IS_ERR(clk)) { - ret = PTR_ERR(clk); - goto free_master; - } + if (IS_ERR(clk)) + return PTR_ERR(clk); + ret = clk_prepare_enable(clk); if (ret) - goto free_master; + return ret; mps->clk_mclk = clk; mps->mclk_rate = clk_get_rate(clk); @@ -535,8 +531,6 @@ free_ipg_clock: clk_disable_unprepare(mps->clk_ipg); free_mclk_clock: clk_disable_unprepare(mps->clk_mclk); -free_master: - spi_master_put(master); return ret; } |