Re: [PATCH v2 1/2] most: core: fix resource leak in most_register_interface error paths

From: Abdun Nihaal

Date: Wed Nov 26 2025 - 12:23:42 EST


On Tue, Nov 25, 2025 at 10:56:05PM +0000, Navaneeth K wrote:
> The function most_register_interface() did not correctly release resources
> if it failed early (before device_register). In these cases, it returned
> an error code immediately, leaking the memory allocated for the interface.
>
> Fix this by initializing the device early via device_initialize() and
> calling put_device() on all error paths. This ensures the release
> callback is triggered to free memory.
>
> Switch to using device_add() instead of device_register() to handle
> the split initialization.

Acked-by: Abdun Nihaal <abdun.nihaal@xxxxxxxxx>