Skip to contentSkip to conversation

firmware: dmi: handle missing DMI data gracefully

PATCH In review Ard Biesheuvel 2 participants 2 messages Oct 17, 2017 – Oct 19, 2017 Dmi/smbios support

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 firmware: dmi: handle missing DMI data gracefully

Currently, when booting a kernel with DMI support on a platform that has no DMI tables, the following output is emitted into the kernel log:

  [    0.128818] DMI not present or invalid.
  ...
  [    1.306659] dmi: Firmware registration failed.
  ...
  [    2.908681] dmi-sysfs: dmi entry is absent.

The first one is a pr_info(), but the subsequent ones are pr_err()s that complain about a condition that is not really an error to begin with.

So let's clean this up, and give up silently if dma_available is not set.

---
v2: - don't use dmi_available in dmi-sysfs because it is not exported,
instead, change pr_err to pr_debug

 drivers/firmware/dmi-sysfs.c | 2 +-
 drivers/firmware/dmi_scan.c  | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/firmware/dmi-sysfs.c +1 -1
index d5de6ee8466d..ecf2eeb5f6f9 100644
@@ -652,7 +652,7 @@ static int __init dmi_sysfs_init(void)
 	int val;
 
 	if (!dmi_kobj) {
-		pr_err("dmi-sysfs: dmi entry is absent.\n");
+		pr_debug("dmi-sysfs: dmi entry is absent.\n");
 		error = -ENODATA;
 		goto err;
 	}
drivers/firmware/dmi_scan.c +2 -4
index 783041964439..17a7425063c2 100644
@@ -715,10 +715,8 @@ static int __init dmi_init(void)
 	u8 *dmi_table;
 	int ret = -ENOMEM;
 
-	if (!dmi_available) {
-		ret = -ENODATA;
-		goto err;
-	}
+	if (!dmi_available)
+		return 0;
 
 	/*
 	 * Set up dmi directory at /sys/firmware/dmi. This entry should stay
Signature · 1 line
2.11.0
#1 lore raw

Hi Ard,

Quoted 43 lines · Ard Biesheuvel

Currently, when booting a kernel with DMI support on a platform that has no DMI tables, the following output is emitted into the kernel log:

  [    0.128818] DMI not present or invalid.
  ...
  [    1.306659] dmi: Firmware registration failed.
  ...
  [    2.908681] dmi-sysfs: dmi entry is absent.

The first one is a pr_info(), but the subsequent ones are pr_err()s that complain about a condition that is not really an error to begin with.

So let's clean this up, and give up silently if dma_available is not set.

---
v2: - don't use dmi_available in dmi-sysfs because it is not exported,
instead, change pr_err to pr_debug

 drivers/firmware/dmi-sysfs.c | 2 +-
 drivers/firmware/dmi_scan.c  | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/firmware/dmi-sysfs.c +1 -1
index d5de6ee8466d..ecf2eeb5f6f9 100644
@@ -652,7 +652,7 @@ static int __init dmi_sysfs_init(void)
 	int val;
 
 	if (!dmi_kobj) {
-		pr_err("dmi-sysfs: dmi entry is absent.\n");
+		pr_debug("dmi-sysfs: dmi entry is absent.\n");
 		error = -ENODATA;
 		goto err;
 	}
drivers/firmware/dmi_scan.c +0 -0
index 783041964439..17a7425063c2 100644
@@ -715,10 +715,8 @@ static int __init dmi_init(void)
 	u8 *dmi_table;
 	int ret = -ENOMEM;

drivers/firmware/dmi_scan.c static int __init dmi_init(void) · line 722

Quoted 10 lines
drivers/firmware/dmi_scan.c +2 -4
 
-	if (!dmi_available) {
-		ret = -ENODATA;
-		goto err;
-	}
+	if (!dmi_available)
+		return 0;
 
 	/*
 	 * Set up dmi directory at /sys/firmware/dmi. This entry should stay

Looks good. Applied, thanks!

Signature · 2 lines
Jean Delvare
SUSE L3 Support