All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ma Jun <Jun.Ma2@amd.com>
To: <amd-gfx@lists.freedesktop.org>, <felix.kuehling@amd.com>
Cc: error27@gmail.com, guchun.chen@amd.com
Subject: [PATCH] drm/amdkfd: Release the topology_lock in error case
Date: Wed, 16 Nov 2022 16:04:15 +0800	[thread overview]
Message-ID: <20221116080415.593223-1-Jun.Ma2@amd.com> (raw)

Release the topology_lock in error case

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Reported-by: Dan Carpenter <error27@gmail.com>
---
 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


             reply	other threads:[~2022-11-16  8:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16  8:04 Ma Jun [this message]
2022-11-16 20:49 ` [PATCH] drm/amdkfd: Release the topology_lock in error case Felix Kuehling
2022-11-17  4:28   ` Dan Carpenter
2022-11-17  7:33   ` Ma, Jun
2022-11-17 18:02     ` Felix Kuehling
  -- strict thread matches above, loose matches on Subject: below --
2022-11-21  5:13 Ma Jun
2022-11-21 14:06 ` Felix Kuehling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221116080415.593223-1-Jun.Ma2@amd.com \
    --to=jun.ma2@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=error27@gmail.com \
    --cc=felix.kuehling@amd.com \
    --cc=guchun.chen@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.