public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org,
	linux-acpi@vger.kernel.org
Cc: dan.j.williams@intel.com, vishal.l.verma@intel.com,
	ira.weiny@intel.com, rafael@kernel.org,
	Jonathan Cameron <jonathan.cameron@huawei.com>
Subject: [PATCH v4 1/2] acpi/hmat: Return when generic target is updated
Date: Wed,  5 Nov 2025 16:48:50 -0700	[thread overview]
Message-ID: <20251105234851.81589-5-dave.jiang@intel.com> (raw)
In-Reply-To: <20251105234851.81589-1-dave.jiang@intel.com>

With the current code flow, once the generic target is updated
target->registered is set and the remaining code is skipped.
So return immediately instead of going through the checks and
then skip.

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
no changes
---
 drivers/acpi/numa/hmat.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/numa/hmat.c b/drivers/acpi/numa/hmat.c
index 5a36d57289b4..1dc73d20d989 100644
--- a/drivers/acpi/numa/hmat.c
+++ b/drivers/acpi/numa/hmat.c
@@ -888,12 +888,13 @@ static void hmat_register_target(struct memory_target *target)
 	 * Register generic port perf numbers. The nid may not be
 	 * initialized and is still NUMA_NO_NODE.
 	 */
-	mutex_lock(&target_lock);
-	if (*(u16 *)target->gen_port_device_handle) {
-		hmat_update_generic_target(target);
-		target->registered = true;
+	scoped_guard(mutex, &target_lock) {
+		if (*(u16 *)target->gen_port_device_handle) {
+			hmat_update_generic_target(target);
+			target->registered = true;
+			return;
+		}
 	}
-	mutex_unlock(&target_lock);
 
 	/*
 	 * Skip offline nodes. This can happen when memory
-- 
2.51.1


  parent reply	other threads:[~2025-11-05 23:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-05 23:48 [PATCH v3 0/2] acpi/hmat: hmat_register_target() refactor to address lockdep warning Dave Jiang
2025-11-05 23:48 ` [PATCH v3 1/2] acpi/hmat: Return when generic target is updated Dave Jiang
2025-11-05 23:48 ` [PATCH v3 2/2] acpi/hmat: Fix lockdep warning for hmem_register_resource() Dave Jiang
2025-11-05 23:48 ` [PATCH v4 0/2] acpi/hmat: hmat_register_target() refactor to address lockdep warning Dave Jiang
2025-11-05 23:48 ` Dave Jiang [this message]
2025-11-05 23:48 ` [PATCH v4 2/2] acpi/hmat: Fix lockdep warning for hmem_register_resource() Dave Jiang
2025-11-06 20:27   ` Koralahalli Channabasappa, Smita
2025-11-05 23:52 ` [PATCH v3 0/2] acpi/hmat: hmat_register_target() refactor to address lockdep warning Dave Jiang

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=20251105234851.81589-5-dave.jiang@intel.com \
    --to=dave.jiang@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=rafael@kernel.org \
    --cc=vishal.l.verma@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox