Re: [PATCH] regulator: wm8400: fix reference leak on failed device registration

From: Guangshuo Li

Date: Fri Apr 24 2026 - 04:40:22 EST


Hi Mark,

Thanks for the review and clarification.

On Tue, 21 Apr 2026 at 01:38, Mark Brown <broonie@xxxxxxxxxx> wrote:
>
> Note that the device is embedded in wm8400 so we don't want to free it,
> and we don't have a release() callback anyway. The whole lifecycle is
> messed up here, the subdevices should probably be dynamically allocated.

You are right. The platform_device is embedded in struct wm8400 and does
not have a release callback, so calling platform_device_put() on the
platform_device_register() failure path is not appropriate here.

Please disregard this patch. I will drop it. As you said, the lifecycle
is more fundamentally wrong here and would need a different fix, such as
using dynamically allocated subdevices, rather than adding
platform_device_put() in this path.

Sorry for the noise.

Best regards,
Guangshuo Li