Re: [PATCH 5/6] ASoC: cs42l52: Fix beep input device leak on card re-bind

From: Charles Keepax

Date: Mon Sep 14 2026 - 09:49:42 EST


On Sun, Sep 13, 2026 at 07:15:30PM +0900, Chancel Liu wrote:
> From: Chancel Liu <chancel.liu@xxxxxxx>
>
> cs42l52 allocates its beep input device with devm_input_allocate_device()
> from the ASoC component probe, but the associated devres cleanup is tied
> to the underlying I2C device, while cs42l52_free_beep() on the component
> remove path only clears the cs42l52->beep pointer.
>
> The input device is only leaked when the sound card is unregistered and
> re-registered while the I2C device stays bound. On that path the
> component probe runs again and allocates and registers a new input
> device every time, leaking the previous one and its sysfs/input node.
>
> Allocate the beep device with input_allocate_device() and pair it with
> the component lifecycle: input_free_device() on registration failure and
> input_unregister_device() in cs42l52_free_beep().
>
> Signed-off-by: Chancel Liu <chancel.liu@xxxxxxx>
> ---

Reviewed-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>

Thanks,
Charles