lkml.org 
[lkml]   [2013]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] Print the actual UEFI error name, not just the error code.
From
Date
On Thu, 2013-05-23 at 14:37 -0400, Peter Jones wrote:
> EFI error numbers are useful, but symbol names are way easier to
> understand when you're reading bug reports. And since, for the most
> part, we know the names, we should show them.
[]
> diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
[]
> +#define efi_pr_warn(status, fmt, ...) ({ \
> + typeof(status) __status = EFI_REVERSE_ERROR(status); \
> + if (__status >= 0 && \
> + __status <= EFI_REVERSE_ERROR(EFI_MAX_ERROR))\
> + pr_warn(fmt ": %s (0x%lx)\n", ## __VA_ARGS__, \
> + efi_error_strings[__status], __status); \
> + else \
> + pr_warn(fmt ": 0x%lx\n", ## __VA_ARGS__, __status);\
> + })

This doubles the number of formats (and code size text) used.

Please don't remove trailing newlines from these sorts
of messages.

I think a function to return "unknown efi error" would be
acceptable and these should become something like:

const char *efi_error_string(unsigned long status)
{
if (status <= EFI_REVERSE_ERROR(EFI_MAX_ERROR))
return efi_error_strings[status];
return "unknown efi error";
}

and the uses something like:

> - printk(KERN_WARNING "efivars: set_variable() failed: status=%lx\n",
> - status);
--
pr_warn("set_variable() failed: %s (%lx)\n",
efi_error_string(status), status);

(with #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt)




\
 
 \ /
  Last update: 2013-05-23 21:41    [W:0.024 / U:0.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site