Skip to content

Commit 793e924

Browse files
author
CKI KWF Bot
committed
Merge: ACPI: PRM: Reduce unnecessary printing to avoid user confusion
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1310 JIRA: https://issues.redhat.com/browse/RHEL-107449 Upstream Status: upstream This patch reduce unnecessary printing to avoid user confusion when ACPI parameter buffer address may be NULL. Signed-off-by: Frank Liang <[email protected]> Approved-by: Vitaly Kuznetsov <[email protected]> Approved-by: Mark Langsdorf <[email protected]> Approved-by: CKI KWF Bot <[email protected]> Merged-by: CKI GitLab Kmaint Pipeline Bot <[email protected]>
2 parents 012d291 + df00b02 commit 793e924

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

drivers/acpi/prmt.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ static u64 efi_pa_va_lookup(efi_guid_t *guid, u64 pa)
8585
}
8686
}
8787

88-
pr_warn("Failed to find VA for GUID: %pUL, PA: 0x%llx", guid, pa);
89-
9088
return 0;
9189
}
9290

@@ -154,13 +152,37 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
154152
guid_copy(&th->guid, (guid_t *)handler_info->handler_guid);
155153
th->handler_addr =
156154
(void *)efi_pa_va_lookup(&th->guid, handler_info->handler_address);
155+
/*
156+
* Print a warning message if handler_addr is zero which is not expected to
157+
* ever happen.
158+
*/
159+
if (unlikely(!th->handler_addr))
160+
pr_warn("Failed to find VA of handler for GUID: %pUL, PA: 0x%llx",
161+
&th->guid, handler_info->handler_address);
157162

158163
th->static_data_buffer_addr =
159164
efi_pa_va_lookup(&th->guid, handler_info->static_data_buffer_address);
165+
/*
166+
* According to the PRM specification, static_data_buffer_address can be zero,
167+
* so avoid printing a warning message in that case. Otherwise, if the
168+
* return value of efi_pa_va_lookup() is zero, print the message.
169+
*/
170+
if (unlikely(!th->static_data_buffer_addr && handler_info->static_data_buffer_address))
171+
pr_warn("Failed to find VA of static data buffer for GUID: %pUL, PA: 0x%llx",
172+
&th->guid, handler_info->static_data_buffer_address);
160173

161174
th->acpi_param_buffer_addr =
162175
efi_pa_va_lookup(&th->guid, handler_info->acpi_param_buffer_address);
163176

177+
/*
178+
* According to the PRM specification, acpi_param_buffer_address can be zero,
179+
* so avoid printing a warning message in that case. Otherwise, if the
180+
* return value of efi_pa_va_lookup() is zero, print the message.
181+
*/
182+
if (unlikely(!th->acpi_param_buffer_addr && handler_info->acpi_param_buffer_address))
183+
pr_warn("Failed to find VA of acpi param buffer for GUID: %pUL, PA: 0x%llx",
184+
&th->guid, handler_info->acpi_param_buffer_address);
185+
164186
} while (++cur_handler < tm->handler_count && (handler_info = get_next_handler(handler_info)));
165187

166188
return 0;

0 commit comments

Comments
 (0)