]> Gentwo Git Trees - linux/.git/commitdiff
acpi/hmat: Return when generic target is updated
authorDave Jiang <dave.jiang@intel.com>
Wed, 5 Nov 2025 23:51:14 +0000 (16:51 -0700)
committerDave Jiang <dave.jiang@intel.com>
Wed, 12 Nov 2025 21:15:33 +0000 (14:15 -0700)
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>
Link: https://patch.msgid.link/20251105235115.85062-2-dave.jiang@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/acpi/numa/hmat.c

index 5a36d57289b43d3c20a2ed23abadb759ffa96f0b..1dc73d20d989519bc48e1f87b61562dcc3a23cca 100644 (file)
@@ -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