Re: [PATCH] Print the actual UEFI error name, not just the error code.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)


--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux