Re: [PATCH v2] platform/x86/amd/pmf: fix cleanup in amd_pmf_init_smart_pc()

From: Ilpo Järvinen
Date: Tue Mar 11 2025 - 13:39:51 EST


On Mon, 10 Mar 2025 22:48:29 +0300, Dan Carpenter wrote:

> There are a few problems in this code:
>
> First, if amd_pmf_tee_init() fails then the function returns directly
> instead of cleaning up. We cannot simply do a "goto error;" because
> the amd_pmf_tee_init() cleanup calls tee_shm_free(dev->fw_shm_pool);
> and amd_pmf_tee_deinit() calls it as well leading to a double free.
> I have re-written this code to use an unwind ladder to free the
> allocations.
>
> [...]


Thank you for your contribution, it has been applied to my local
review-ilpo-fixes branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/1] platform/x86/amd/pmf: fix cleanup in amd_pmf_init_smart_pc()
commit: 5b1122fc4995f308b21d7cfc64ef9880ac834d20

--
i.