amd_pmc: Avoid "(null)" in log message
Subsystems (2)
cover amd_pmc: Avoid "(null)" in log message
The kernel test robot complained that dmi_get_system_info(...) is used for %s arguments of a dev_info() call, because it can return NULL. That would lead to "(null)" being printed in those messages.
Ilpo Järvinen suggested using the Elvis operator to print something that is more informative for normal users. Now "(Unknown)" is printed instead.
See: https://lore.kernel.org/all/[email protected]/T/#u
Daniel Gibson (1):
platform/x86/amd/pmc: Avoid logging "(null)" for DMI values
drivers/platform/x86/amd/pmc/pmc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
2.48.1
PATCH 1/1 platform/x86/amd/pmc: Avoid logging "(null)" for DMI values
dmi_get_system_info(...) can return NULL. Using that as %s arguments of dev_info() would log "(null)" (as part of a message like '... System Vendor: "(null)", Product Name: "(null)" ...'), which may be confusing for users.
Use Elvis operator to print "(Unknown)" instead.
--- drivers/platform/x86/amd/pmc/pmc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/platform/x86/amd/pmc/pmc.c +5 -5
@@ -732,11 +732,11 @@ static bool amd_pmc_want_suspend_delay(struct amd_pmc_dev *pdev) }else if (delay_suspend ==1 ) {if (!intermediate_wakeup)dev_info (pdev->dev,"Delaying suspend by 2.5s because delay_suspend=1. If this solves problems on your machine, please report this whole line to: [email protected] so it can be automatically detected as affected in the future. System Vendor: \"%s\" Product Name: \"%s\" Product Family: \"%s\" Board Vendor: \"%s\" Board Name: \"%s\"\n" , -dmi_get_system_info (DMI_SYS_VENDOR ), -dmi_get_system_info (DMI_PRODUCT_NAME ), -dmi_get_system_info (DMI_PRODUCT_FAMILY ), -dmi_get_system_info (DMI_BOARD_VENDOR ), -dmi_get_system_info (DMI_BOARD_NAME )); +dmi_get_system_info (DMI_SYS_VENDOR ) ?:"(Unknown)" , +dmi_get_system_info (DMI_PRODUCT_NAME ) ?:"(Unknown)" , +dmi_get_system_info (DMI_PRODUCT_FAMILY ) ?:"(Unknown)" , +dmi_get_system_info (DMI_BOARD_VENDOR ) ?:"(Unknown)" , +dmi_get_system_info (DMI_BOARD_NAME ) ?:"(Unknown)" );return true; }return false;
Signature · 1 line
2.48.1
Ilpo Järvinen
maintainerRe: [PATCH 1/1] platform/x86/amd/pmc: Avoid logging "(null)" for DMI values
Quoted 8 lines · Daniel Gibson
dmi_get_system_info(...)can return NULL. Using that as %s arguments ofdev_info()would log "(null)" (as part of a message like '... System Vendor: "(null)", Product Name: "(null)" ...'), which may be confusing for users.Use Elvis operator to print "(Unknown)" instead.
[...]
Thank you for your contribution, it has been applied to my local review-ilpo-fixes branch. Note it will show up in the public platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my local branch there, which might take a while.
The list of commits applied:
[1/1] platform/x86/amd/pmc: Avoid logging "(null)" for DMI values
commit: a0738abd042f7406edd2175a819cf2e66388ed97
--
i.