Re: [PATCH 18/19] spi: omap2-mcspi: switch to managed controller allocation

From: Johan Hovold

Date: Thu Apr 30 2026 - 03:16:31 EST


On Thu, Apr 30, 2026 at 09:30:40AM +0900, Mark Brown wrote:
> On Wed, Apr 29, 2026 at 11:13:32AM +0200, Johan Hovold wrote:
> > Switch to device managed controller allocation to simplify error
> > handling and to avoid having to take another reference during
> > deregistration.
>
> > @@ -1556,7 +1553,7 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
> > status = omap2_mcspi_request_dma(mcspi,
> > &mcspi->dma_channels[i]);
> > if (status == -EPROBE_DEFER)
> > - goto free_ctlr;
> > + return status;
> > }
>
> Here we return directly...
>
> > @@ -1604,7 +1601,7 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
> > pm_runtime_disable(&pdev->dev);
> > free_ctlr:
> > omap2_mcspi_release_dma(ctlr);
> > - spi_controller_put(ctlr);
>
> ...which skips the _release_dma() as well as the put - I think the label
> needs a rename and the goto keeping (or some more refactoring to also
> use devm for the DMA, but that's more work).

This works as intended since omap2_mcspi_request_dma() cleans up after
itself on failure.

I can send a follow-up renaming the error label as this is arguably not
an issue introduced by this patch even if it makes it more noticeable.

Or do you prefer a v2 (posted separately from the series)?

Johan

Attachment: signature.asc
Description: PGP signature