mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/1] amd_pmc: Avoid "(null)" in log message
@ 2026-06-26 22:02 Daniel Gibson
  2026-06-26 22:02 ` [PATCH 1/1] platform/x86/amd/pmc: Avoid logging "(null)" for DMI values Daniel Gibson
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Gibson @ 2026-06-26 22:02 UTC (permalink / raw)
  To: Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
	platform-driver-x86, linux-kernel
  Cc: Daniel Gibson

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/202606251540.Nr2BtaNu-lkp@intel.com/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(-)

-- 
2.48.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] platform/x86/amd/pmc: Avoid logging "(null)" for DMI values
  2026-06-26 22:02 [PATCH 0/1] amd_pmc: Avoid "(null)" in log message Daniel Gibson
@ 2026-06-26 22:02 ` Daniel Gibson
  2026-07-03 13:42   ` Ilpo Järvinen
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Gibson @ 2026-06-26 22:02 UTC (permalink / raw)
  To: Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
	platform-driver-x86, linux-kernel
  Cc: Daniel Gibson, kernel test robot

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.

Fixes: 428b9fd2dce5 ("platform/x86/amd/pmc: Add delay_suspend module parameter")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202606251540.Nr2BtaNu-lkp@intel.com/
Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Daniel Gibson <daniel@gibson.sh>
---
 drivers/platform/x86/amd/pmc/pmc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
index b2eb9909f6a4..26ddaa1c2e7f 100644
--- a/drivers/platform/x86/amd/pmc/pmc.c
+++ b/drivers/platform/x86/amd/pmc/pmc.c
@@ -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: platform-driver-x86@vger.kernel.org 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;
-- 
2.48.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] platform/x86/amd/pmc: Avoid logging "(null)" for DMI values
  2026-06-26 22:02 ` [PATCH 1/1] platform/x86/amd/pmc: Avoid logging "(null)" for DMI values Daniel Gibson
@ 2026-07-03 13:42   ` Ilpo Järvinen
  0 siblings, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2026-07-03 13:42 UTC (permalink / raw)
  To: Shyam Sundar S K, Hans de Goede, platform-driver-x86,
	linux-kernel, Daniel Gibson
  Cc: kernel test robot

On Sat, 27 Jun 2026 00:02:10 +0200, Daniel Gibson wrote:

> 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.
> 
> [...]


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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-03 13:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-26 22:02 [PATCH 0/1] amd_pmc: Avoid "(null)" in log message Daniel Gibson
2026-06-26 22:02 ` [PATCH 1/1] platform/x86/amd/pmc: Avoid logging "(null)" for DMI values Daniel Gibson
2026-07-03 13:42   ` Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®