diff mbox series

[1/1] efi_loader: simplify error message in efi_disk_create_raw()

Message ID 20240202141252.62378-1-heinrich.schuchardt@canonical.com
State Accepted, archived
Commit 50457f547de8f719566476436321b51a33b792a0
Delegated to: Heinrich Schuchardt
Headers show
Series [1/1] efi_loader: simplify error message in efi_disk_create_raw() | expand

Commit Message

Heinrich Schuchardt Feb. 2, 2024, 2:12 p.m. UTC
The error message

    Adding disk for usb_mass_storage.lun0 failed (err=-9223372036854775788/0x8000000000000014)

provides a decimal and a hexadecimal notation of the EFI status code
EFI_ALREADY_STARTED which is defined as (EFI_ERROR_MASK | 20).
The decimal output does not convey the value 20 clearly.

With the patch we write

    Adding block device usb_mass_storage.lun0 failed, r = 20

similar to other EFI error messages.

Fixes: 952018117ab4 ("dm: sandbox: Switch over to using the new host uclass")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 lib/efi_loader/efi_disk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ilias Apalodimas Feb. 14, 2024, 6:42 a.m. UTC | #1
On Fri, 2 Feb 2024 at 16:13, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> The error message
>
>     Adding disk for usb_mass_storage.lun0 failed (err=-9223372036854775788/0x8000000000000014)
>
> provides a decimal and a hexadecimal notation of the EFI status code
> EFI_ALREADY_STARTED which is defined as (EFI_ERROR_MASK | 20).
> The decimal output does not convey the value 20 clearly.
>
> With the patch we write
>
>     Adding block device usb_mass_storage.lun0 failed, r = 20
>
> similar to other EFI error messages.
>
> Fixes: 952018117ab4 ("dm: sandbox: Switch over to using the new host uclass")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  lib/efi_loader/efi_disk.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> index b1739d99201..2fefd05fbdc 100644
> --- a/lib/efi_loader/efi_disk.c
> +++ b/lib/efi_loader/efi_disk.c
> @@ -574,7 +574,8 @@ static int efi_disk_create_raw(struct udevice *dev, efi_handle_t agent_handle)
>                         log_notice("Disk %s not ready\n", dev->name);
>                         ret = -EBUSY;
>                 } else {
> -                       log_err("Adding disk for %s failed (err=%ld/%#lx)\n", dev->name, ret, ret);
> +                       log_err("Adding block device %s failed, r = %lu\n",
> +                               dev->name, ret & ~EFI_ERROR_MASK);
>                         ret = -ENOENT;
>                 }
>
> --
> 2.43.0
>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Caleb Connolly Feb. 20, 2024, 11:44 a.m. UTC | #2
On 02/02/2024 14:12, Heinrich Schuchardt wrote:
> The error message
> 
>     Adding disk for usb_mass_storage.lun0 failed (err=-9223372036854775788/0x8000000000000014)
> 
> provides a decimal and a hexadecimal notation of the EFI status code
> EFI_ALREADY_STARTED which is defined as (EFI_ERROR_MASK | 20).
> The decimal output does not convey the value 20 clearly.
> 
> With the patch we write
> 
>     Adding block device usb_mass_storage.lun0 failed, r = 20
> 
> similar to other EFI error messages.
> 
> Fixes: 952018117ab4 ("dm: sandbox: Switch over to using the new host uclass")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
> ---
>  lib/efi_loader/efi_disk.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> index b1739d99201..2fefd05fbdc 100644
> --- a/lib/efi_loader/efi_disk.c
> +++ b/lib/efi_loader/efi_disk.c
> @@ -574,7 +574,8 @@ static int efi_disk_create_raw(struct udevice *dev, efi_handle_t agent_handle)
>  			log_notice("Disk %s not ready\n", dev->name);
>  			ret = -EBUSY;
>  		} else {
> -			log_err("Adding disk for %s failed (err=%ld/%#lx)\n", dev->name, ret, ret);
> +			log_err("Adding block device %s failed, r = %lu\n",
> +				dev->name, ret & ~EFI_ERROR_MASK);
>  			ret = -ENOENT;
>  		}
>
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index b1739d99201..2fefd05fbdc 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -574,7 +574,8 @@  static int efi_disk_create_raw(struct udevice *dev, efi_handle_t agent_handle)
 			log_notice("Disk %s not ready\n", dev->name);
 			ret = -EBUSY;
 		} else {
-			log_err("Adding disk for %s failed (err=%ld/%#lx)\n", dev->name, ret, ret);
+			log_err("Adding block device %s failed, r = %lu\n",
+				dev->name, ret & ~EFI_ERROR_MASK);
 			ret = -ENOENT;
 		}