Skip to contentSkip to conversation

disk/pata: Suppress error message "no device connected"

PATCH In review Glenn Washburn 3 participants 3 messages Mar 1, 2021 – Mar 3, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 disk/pata: Suppress error message "no device connected"

This error message comes from the grub_print_error in grub_pata_device_initialize, which does not pass on the error, and is raised in check_device. The function check_device needs to return this as an error because check_device is also used in grub_pata_open, which does pass on this error to indicate that the device can not be used.

This is actually not an error when displayed by grub_pata_device_initialize because it just indicates that there are no pata devices seen. This may be confusing to end users who do not have pata devices yet are loading the pata module (perhaps implicitly via nativedisk). This also causes unnessary output which may need to be accounted for in functional testing.

Instead print to the debug log when check_device raises this "error" and pop the error from the error stack. If there is another error on the stack then print the error stack as those should be real errors.

---
 grub-core/disk/pata.c | 6 ++++++
 1 file changed, 6 insertions(+)
grub-core/disk/pata.c +6 -0
index 23eef2be1..b15aeaa13 100644
@@ -331,6 +331,12 @@ grub_pata_device_initialize (int port, int device, int addr)
   *devp = dev;
 
   err = check_device (dev);
+  if (err == GRUB_ERR_UNKNOWN_DEVICE)
+    {
+      grub_dprintf ("pata", "%s\n", grub_errmsg);
+      grub_error_pop();
+    }
+
   if (err)
     grub_print_error ();
 
Signature · 1 line
2.27.0
Acked-by on v1 1/1
#1 lore raw

Dear Glenn,

Am 01.03.21 um 20:36 schrieb Glenn Washburn:

Quoted 26 lines

This error message comes from the grub_print_error in grub_pata_device_initialize, which does not pass on the error, and is raised in check_device. The function check_device needs to return this as an error because check_device is also used in grub_pata_open, which does pass on this error to indicate that the device can not be used.

This is actually not an error when displayed by grub_pata_device_initialize because it just indicates that there are no pata devices seen. This may be confusing to end users who do not have pata devices yet are loading the pata module (perhaps implicitly via nativedisk). This also causes unnessary output which may need to be accounted for in functional testing.

Instead print to the debug log when check_device raises this "error" and pop the error from the error stack. If there is another error on the stack then print the error stack as those should be real errors.

---
  grub-core/disk/pata.c | 6 ++++++
  1 file changed, 6 insertions(+)
grub-core/disk/pata.c +0 -0
index 23eef2be1..b15aeaa13 100644

grub-core/disk/pata.c grub_pata_device_initialize (int port, int device, int addr) · line 339

Quoted 9 lines
grub-core/disk/pata.c +6 -0
@@ -331,6 +331,12 @@ grub_pata_device_initialize (int port, int device, int addr)
    *devp = dev;
 
    err = check_device (dev);
+  if (err == GRUB_ERR_UNKNOWN_DEVICE)
+    {
+      grub_dprintf ("pata", "%s\n", grub_errmsg);
+      grub_error_pop();
+    }
+

(The indentation looks wrong in Mozilla Thunderbird, but applying the patch, everything is fine. The non-changed lines are indented by two spaces too much.)

grub-core/disk/pata.c grub_pata_device_initialize (int port, int device, int addr) · line 341

Quoted 2 lines
grub-core/disk/pata.c +0 -0
    if (err)
      grub_print_error ();

Kind regards,

Paul

Reviewed-by
#2 lore raw
Quoted 42 lines · Paul Menzel

Dear Glenn,

Am 01.03.21 um 20:36 schrieb Glenn Washburn:

Quoted 26 lines

This error message comes from the grub_print_error in grub_pata_device_initialize, which does not pass on the error, and is raised in check_device. The function check_device needs to return this as an error because check_device is also used in grub_pata_open, which does pass on this error to indicate that the device can not be used.

This is actually not an error when displayed by grub_pata_device_initialize because it just indicates that there are no pata devices seen. This may be confusing to end users who do not have pata devices yet are loading the pata module (perhaps implicitly via nativedisk). This also causes unnessary output which may need to be accounted for in functional testing.

Instead print to the debug log when check_device raises this "error" and pop the error from the error stack. If there is another error on the stack then print the error stack as those should be real errors.

---
  grub-core/disk/pata.c | 6 ++++++
  1 file changed, 6 insertions(+)
grub-core/disk/pata.c +0 -0
index 23eef2be1..b15aeaa13 100644

grub-core/disk/pata.c grub_pata_device_initialize (int port, int device, int addr) · line 338

Quoted 8 lines
grub-core/disk/pata.c +6 -0
@@ -331,6 +331,12 @@ grub_pata_device_initialize (int port, int device, int addr)
    *devp = dev;
    err = check_device (dev);
+  if (err == GRUB_ERR_UNKNOWN_DEVICE)
+    {
+      grub_dprintf ("pata", "%s\n", grub_errmsg);
+      grub_error_pop();
+    }
+

(The indentation looks wrong in Mozilla Thunderbird, but applying the patch, everything is fine. The non-changed lines are indented by two spaces too much.)

Quoted 5 lines

grub-core/disk/pata.c grub_pata_device_initialize (int port, int device, int addr) · line 341

Quoted 2 lines
grub-core/disk/pata.c +0 -0
    if (err)
      grub_print_error ();

Daniel