From: Matt Fleming Date: Wed, 16 Jan 2013 13:47:05 +0000 (+0000) Subject: efivarfs: Never return ENOENT from firmware X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=1fa7e69;p=linux-beck.git efivarfs: Never return ENOENT from firmware Files are created in efivarfs_create() before a corresponding variable is created in the firmware. This leads to users being able to read/write to the file without the variable existing in the firmware. Reading a non-existent variable currently returns -ENOENT, which is confusing because the file obviously *does* exist. Convert EFI_NOT_FOUND into -EIO which is the closest thing to "error while interacting with firmware", and should hopefully indicate to the caller that the variable is in some uninitialised state. Cc: Josh Boyer Acked-by: Jeremy Kerr Cc: Lee, Chun-Yi Cc: Andy Whitcroft Reported-by: Lingzhu Xiang Signed-off-by: Matt Fleming --- diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index fa9fa038de3f..807dad48b2b1 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c @@ -674,7 +674,7 @@ static int efi_status_to_err(efi_status_t status) err = -EACCES; break; case EFI_NOT_FOUND: - err = -ENOENT; + err = -EIO; break; default: err = -EINVAL;