Re: [RESEND PATCH v4 1/2] acpi/hmat: Return when generic target is updated

Dave Jiang
2025-11-12T22:00:28Z

On 11/5/25 4:51 PM, Dave Jiang wrote:
> 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>

Applied to cxl/next
15e14267889bde30b7b82bc03432483222b4b42c

> ---
> 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