Re: [PATCH] spi: fix controller registration API inconsistency

From: Johan Hovold

Date: Thu May 21 2026 - 03:39:42 EST


On Wed, May 20, 2026 at 02:38:51PM +0100, Mark Brown wrote:
> On Tue, May 12, 2026 at 04:01:31PM +0200, Johan Hovold wrote:
>
> > With most drivers converted to use managed allocation in preparation for
> > fixing the API, the remaining 16 drivers can be converted in one
> > tree-wide change. Ten of those drivers use the bitbang interface and can
> > be converted by simply removing the extra reference already taken by
> > spi_bitbang_start(). [4]
>
> > Fix the API inconsistency by no longer dropping a reference when
> > deregistering non-devres allocated controllers.
>
> > - *
> > - * On success, this routine will take a reference to the controller. The caller
> > - * is responsible for calling spi_bitbang_stop() to decrement the reference and
> > - * spi_controller_put() as counterpart of spi_alloc_host() to prevent a memory
> > - * leak.
> > */
>
> The xilinx and xtensa-xtfpga drivers use devm_spi_alloc_host() and
> spi_bitbang_start() but still call spi_controller_put() in their remove
> paths.

Thanks for catching that. I've just posted a v2 here:

https://lore.kernel.org/r/20260521073816.766596-1-johan@xxxxxxxxxx

Johan

Attachment: signature.asc
Description: PGP signature