Re: [PATCH] soc: mediatek: SVS: Fix memory leak in svs_enable_debug_write()

From: Zilin Guan
Date: Sun Dec 28 2025 - 12:38:01 EST


On Sun, Dec 28, 2025 at 03:19:00PM+0100, Markus Elfring wrote:
>
> > Fix this by freeing buf before returning the error code.
>
> How do you think about to use the attribute “__free(kfree)”?
> https://elixir.bootlin.com/linux/v6.19-rc2/source/include/linux/slab.h#L512
> https://elixir.bootlin.com/linux/v6.19-rc2/source/drivers/soc/mediatek/mtk-svs.c#L785-L813
>
> Regards,
> Markus

Hi Markus,

Thanks for the suggestion.

I agree that using the "__free(kfree)" attribute is a good way to
simplify memory management here. I will apply this change in the
v2 patch.

Regards,
Zilin Guan