efi_loader: return values of GetTime()
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 19 May 2019 19:41:28 +0000 (21:41 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Fri, 24 May 2019 16:58:13 +0000 (18:58 +0200)
According to the UEFI spec 2.8 the GetTime() runtime service should return
EFI_UNSUPPORTED if the real time clock is not available.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
lib/efi_loader/efi_runtime.c

index 8d1370b4dd1a4673d8a1471c4ea8108cfe879bc6..058b40a88768dc394dac1fd933ab8abf6d27902a 100644 (file)
@@ -169,7 +169,6 @@ static efi_status_t EFIAPI efi_get_time_boottime(
 {
 #ifdef CONFIG_DM_RTC
        efi_status_t ret = EFI_SUCCESS;
-       int r;
        struct rtc_time tm;
        struct udevice *dev;
 
@@ -179,11 +178,12 @@ static efi_status_t EFIAPI efi_get_time_boottime(
                ret = EFI_INVALID_PARAMETER;
                goto out;
        }
-
-       r = uclass_get_device(UCLASS_RTC, 0, &dev);
-       if (!r)
-               r = dm_rtc_get(dev, &tm);
-       if (r) {
+       if (uclass_get_device(UCLASS_RTC, 0, &dev) ||
+           dm_rtc_get(dev, &tm)) {
+               ret = EFI_UNSUPPORTED;
+               goto out;
+       }
+       if (dm_rtc_get(dev, &tm)) {
                ret = EFI_DEVICE_ERROR;
                goto out;
        }
@@ -210,7 +210,7 @@ out:
        return EFI_EXIT(ret);
 #else
        EFI_ENTRY("%p %p", time, capabilities);
-       return EFI_EXIT(EFI_DEVICE_ERROR);
+       return EFI_EXIT(EFI_UNSUPPORTED);
 #endif
 }