Skip to content

Commit 9375e5e

Browse files
Dan Carpenterrafaeljw
authored andcommitted
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: 04f5354 ("ACPI: MRRM: Add /sys files to describe memory ranges") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://patch.msgid.link/aDVTfEm-Jch7FuHG@stanley.mountain Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 059717c commit 9375e5e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/acpi/acpi_mrrm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,10 @@ static __init int add_boot_memory_ranges(void)
157157

158158
for (int i = 0; i < mrrm_mem_entry_num; i++) {
159159
name = kasprintf(GFP_KERNEL, "range%d", i);
160-
if (!name)
160+
if (!name) {
161+
ret = -ENOMEM;
161162
break;
163+
}
162164

163165
kobj = kobject_create_and_add(name, pkobj);
164166

0 commit comments

Comments
 (0)