From 59fcc285f4e2b79793733922869c0e94375ff17d Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Thu, 21 Sep 2017 23:14:07 +0000 Subject: [PATCH] libefi: efi_devpath_match() should return bool The current implementation of efi_devpath_match() is returning values 0 or 1, so it should be updated to return bool. --- sys/boot/efi/libefi/devpath.c | 14 +++++++------- sys/boot/efi/libefi/efipart.c | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/boot/efi/libefi/devpath.c b/sys/boot/efi/libefi/devpath.c index 662f0a744ef7..934d9d0654b8 100644 --- a/sys/boot/efi/libefi/devpath.c +++ b/sys/boot/efi/libefi/devpath.c @@ -139,30 +139,30 @@ efi_devpath_handle(EFI_DEVICE_PATH *devpath) return (h); } -int +bool efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVICE_PATH *devpath2) { int len; if (devpath1 == NULL || devpath2 == NULL) - return (0); + return (false); - while (1) { + while (true) { if (DevicePathType(devpath1) != DevicePathType(devpath2) || DevicePathSubType(devpath1) != DevicePathSubType(devpath2)) - return (0); + return (false); len = DevicePathNodeLength(devpath1); if (len != DevicePathNodeLength(devpath2)) - return (0); + return (false); if (memcmp(devpath1, devpath2, (size_t)len) != 0) - return (0); + return (false); if (IsDevicePathEnd(devpath1)) break; devpath1 = NextDevicePathNode(devpath1); devpath2 = NextDevicePathNode(devpath2); } - return (1); + return (true); } diff --git a/sys/boot/efi/libefi/efipart.c b/sys/boot/efi/libefi/efipart.c index 13c70c8151cf..c6e582379084 100644 --- a/sys/boot/efi/libefi/efipart.c +++ b/sys/boot/efi/libefi/efipart.c @@ -264,7 +264,7 @@ efipart_cdinfo_add(EFI_HANDLE handle, EFI_HANDLE alias, unit = 0; STAILQ_FOREACH(pd, &cdinfo, pd_link) { - if (efi_devpath_match(pd->pd_devpath, devpath) != 0) { + if (efi_devpath_match(pd->pd_devpath, devpath) == true) { pd->pd_handle = handle; pd->pd_alias = alias; return (0); @@ -394,7 +394,7 @@ efipart_hdinfo_add(EFI_HANDLE disk_handle, EFI_HANDLE part_handle) STAILQ_INIT(&pd->pd_part); STAILQ_FOREACH(hd, &hdinfo, pd_link) { - if (efi_devpath_match(hd->pd_devpath, disk_devpath) != 0) { + if (efi_devpath_match(hd->pd_devpath, disk_devpath) == true) { /* Add the partition. */ pd->pd_handle = part_handle; pd->pd_unit = node->PartitionNumber;