[PATCH v3 0/2] media: amd: isp4: fix error handling in isp4sd_pwron_and_init()

From: Yifei Gao

Date: Tue Jul 28 2026 - 10:27:38 EST


This series fixes the error handling in isp4sd_pwron_and_init().

Patch 1 makes isp4if_alloc_fw_gpumem() release partial allocations on
failure. This is an independent leak that was previously masked by the
deadlock fixed in patch 2: the thread deadlocked before the teardown
that would have freed the buffers could run.

Patch 2 reworks the power-on error path into staged cleanup. This fixes
the self-deadlock and, once the deadlock is removed and the error path
actually runs, the runtime-PM usage-count imbalance and the MMIO access
while unpowered that were previously unreachable.

The staged error path in patch 2 relies on isp4if_start() cleaning up
fully on failure, which patch 1 completes, so patch 1 comes first.

Changes since v2:
- Added patch 1 to release partial allocations in
isp4if_alloc_fw_gpumem(), as pointed out by Bin Du.
- Patch 2 (the power-on staged cleanup) is unchanged from v2.

v2: https://lore.kernel.org/linux-media/20260727183500.298036-1-gyf161023@xxxxxxxxx/
v1: https://lore.kernel.org/linux-media/20260725203640.915626-1-gyf161023@xxxxxxxxx/

Yifei Gao (2):
media: amd: isp4: release partial allocations in
isp4if_alloc_fw_gpumem()
media: amd: isp4: fix self-deadlock in isp4sd_pwron_and_init() error
path

.../media/platform/amd/isp4/isp4_interface.c | 1 +
drivers/media/platform/amd/isp4/isp4_subdev.c | 28 +++++++++++++++----
2 files changed, 23 insertions(+), 6 deletions(-)

--
2.43.0