]> mj.ucw.cz Git - pciutils.git/commitdiff
libpci: i386-io-windows.h: Improve ProcessUserModeIOPL error message
authorPali Rohár <pali@kernel.org>
Sat, 5 Mar 2022 23:25:02 +0000 (00:25 +0100)
committerPali Rohár <pali@kernel.org>
Sun, 30 Oct 2022 15:31:52 +0000 (16:31 +0100)
Show error message from intel_setup_io() function into debug area instead
of error area. This is what other backends do as intel_setup_io() is called
during quite detect phase, which may fail.

Also show human readable failure instead of magic code number.

lib/i386-io-windows.h

index 1509d7de86803252718d3f70aa11054872b841a6..6bb578cb40d74c0fccefc119e66e858ad8b9b4d3 100644 (file)
@@ -1343,7 +1343,8 @@ intel_setup_io(struct pci_access *a)
   /* On NT-based systems issue ProcessUserModeIOPL syscall which changes IOPL to 3. */
   if (!SetProcessUserModeIOPL())
     {
-      a->warning("NT ProcessUserModeIOPL call failed with error: %lu.", (unsigned long int)GetLastError());
+      DWORD error = GetLastError();
+      a->debug("NT ProcessUserModeIOPL call failed: %s.", error == ERROR_INVALID_FUNCTION ? "Not Implemented" : error == ERROR_PRIVILEGE_NOT_HELD ? "Access Denied" : "Operation Failed");
       return 0;
     }