Re: [PATCH] spi: fix reference leak in spi_register_controller()
From: Mark Brown
Date: Tue Dec 17 2024 - 10:25:58 EST
On Tue, Dec 17, 2024 at 03:31:33PM +0800, Ma Ke wrote:
> Once device_add() failed, we should call put_device() to decrement
> reference count for cleanup. Or it could cause memory leak.
>
> Found by code review.
This isn't clear to me, spi_register_controller() is analogous to
device_add() and __spi_alloc_controller() is analogous to (and wraps)
device_initialize() so I'd expect the _put() to be done by the caller
calling spi_controller_put() either directly or more usually via devm.
Attachment:
signature.asc
Description: PGP signature