]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-boot: Invert if in disk_get_part_uuid()
authorJan Janssen <medhefgo@web.de>
Fri, 24 Sep 2021 08:24:38 +0000 (10:24 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 12 Oct 2021 07:53:16 +0000 (09:53 +0200)
src/boot/efi/disk.c

index 196dc52be58d80b36324ff75594a8e167acc87db..6d3c8285a15b56648f5eb3000389825c6c703e5b 100644 (file)
@@ -8,29 +8,29 @@
 
 EFI_STATUS disk_get_part_uuid(EFI_HANDLE *handle, CHAR16 uuid[static 37]) {
         EFI_DEVICE_PATH *device_path;
+        _cleanup_freepool_ EFI_DEVICE_PATH *paths = NULL;
 
         assert(handle);
 
         /* export the device path this image is started from */
         device_path = DevicePathFromHandle(handle);
-        if (device_path) {
-                _cleanup_freepool_ EFI_DEVICE_PATH *paths = NULL;
-
-                paths = UnpackDevicePath(device_path);
-                for (EFI_DEVICE_PATH *path = paths; !IsDevicePathEnd(path); path = NextDevicePathNode(path)) {
-                        HARDDRIVE_DEVICE_PATH *drive;
-
-                        if (DevicePathType(path) != MEDIA_DEVICE_PATH)
-                                continue;
-                        if (DevicePathSubType(path) != MEDIA_HARDDRIVE_DP)
-                                continue;
-                        drive = (HARDDRIVE_DEVICE_PATH *)path;
-                        if (drive->SignatureType != SIGNATURE_TYPE_GUID)
-                                continue;
-
-                        GuidToString(uuid, (EFI_GUID *)&drive->Signature);
-                        return EFI_SUCCESS;
-                }
+        if (!device_path)
+                return EFI_NOT_FOUND;
+
+        paths = UnpackDevicePath(device_path);
+        for (EFI_DEVICE_PATH *path = paths; !IsDevicePathEnd(path); path = NextDevicePathNode(path)) {
+                HARDDRIVE_DEVICE_PATH *drive;
+
+                if (DevicePathType(path) != MEDIA_DEVICE_PATH)
+                        continue;
+                if (DevicePathSubType(path) != MEDIA_HARDDRIVE_DP)
+                        continue;
+                drive = (HARDDRIVE_DEVICE_PATH *)path;
+                if (drive->SignatureType != SIGNATURE_TYPE_GUID)
+                        continue;
+
+                GuidToString(uuid, (EFI_GUID *)&drive->Signature);
+                return EFI_SUCCESS;
         }
 
         return EFI_NOT_FOUND;