]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
disk/pata: Suppress error message "no device connected"
authorGlenn Washburn <development@efficientek.com>
Mon, 1 Mar 2021 19:36:28 +0000 (13:36 -0600)
committerDaniel Kiper <daniel.kiper@oracle.com>
Wed, 10 Mar 2021 12:22:45 +0000 (13:22 +0100)
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 unnecessary
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.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Acked-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/disk/pata.c

index 23eef2be18c2dc1b88fc4edfe4d9e480a549eadf..c757e65aee2a342a1c086a75f39735847c0e8459 100644 (file)
@@ -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 ();