[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <aDVTfEm-Jch7FuHG@stanley.mountain>
Date: Tue, 27 May 2025 08:54:04 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Tony Luck <tony.luck@...el.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Len Brown <lenb@...nel.org>,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [PATCH next] ACPI: MRRM: Silence error code static checker warning
The error code is not set correctly on if kasprintf() fails. On the
first iteration it would return -EINVAL and subsequent iterations
would return success. Set it to -ENOMEM.
In real life, this allocation will not fail and if it did the system
will not boot so this change is mostly to silence static checker warnings
more than anything else.
Fixes: 04f53540f791 ("ACPI: MRRM: Add /sys files to describe memory ranges")
Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
---
drivers/acpi/acpi_mrrm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/acpi_mrrm.c b/drivers/acpi/acpi_mrrm.c
index 2f22f013959a..70088cdfde13 100644
--- a/drivers/acpi/acpi_mrrm.c
+++ b/drivers/acpi/acpi_mrrm.c
@@ -156,8 +156,10 @@ static __init int add_boot_memory_ranges(void)
for (int i = 0; i < mrrm_mem_entry_num; i++) {
name = kasprintf(GFP_KERNEL, "range%d", i);
- if (!name)
+ if (!name) {
+ ret = -ENOMEM;
break;
+ }
kobj = kobject_create_and_add(name, pkobj);
--
2.47.2
Powered by blists - more mailing lists