Release the topology_lock in error case Signed-off-by: Ma Jun <Jun.Ma2@xxxxxxx> Reported-by: Dan Carpenter <error27@xxxxxxxxx> --- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c index ef9c6fdfb88d..5ea737337658 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c @@ -1841,6 +1841,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu) pr_err("Error creating VCRAT for GPU (ID: 0x%x)\n", gpu_id); topology_crat_proximity_domain--; + up_write(&topology_lock); return res; } @@ -1851,6 +1852,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu) pr_err("Error parsing VCRAT for GPU (ID: 0x%x)\n", gpu_id); topology_crat_proximity_domain--; + up_write(&topology_lock); goto err; } @@ -1860,6 +1862,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu) dev = kfd_assign_gpu(gpu); if (WARN_ON(!dev)) { res = -ENODEV; + up_write(&topology_lock); goto err; } -- 2.25.1