Skip to contentSkip to conversation

efi_loader: remove unused function efi_dp_match()

PATCH In review Vincent Stehlé 2 participants 2 messages Sep 4 – Sep 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi_loader: remove unused function efi_dp_match()

The efi_dp_match() function is unused since commit c409593d0853 ("efi_loader: fix efi_dp_find_obj()"); remove it.

Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Tom Rini <[email protected]>
---
 include/efi_device_path.h        | 19 -------------------
 lib/efi_loader/efi_device_path.c | 22 ----------------------
 2 files changed, 41 deletions(-)
include/efi_device_path.h +0 -19
index aae85228f68..034a476887e 100644
@@ -33,25 +33,6 @@ extern const struct efi_device_path EFI_DP_END;
  */
 struct efi_device_path *efi_dp_next(const struct efi_device_path *dp);
 
-/**
- * efi_dp_match() - Compare two device-paths
- *
- * Compare two device paths node by node. The comparison stops when an End
- * node is reached in the shorter of the two paths. This is useful, for example,
- * to compare a device-path representing a device with one representing a file
- * on that device, or a device with a parent device.
- *
- * @a: Pointer to the first device path.
- * @b: Pointer to the second device path.
- * Return: An integer less than, equal to, or greater than zero if the first
- * differing node in 'a' is found, respectively, to be less than,
- * to match, or be greater than the corresponding node in 'b'. Returns 0
- * if they match up to the end of the shorter path. Compares length first,
- * then content.
- */
-int efi_dp_match(const struct efi_device_path *a,
-		 const struct efi_device_path *b);
-
 /**
  * efi_dp_shorten() - shorten device-path
  *
lib/efi_loader/efi_device_path.c +0 -22
index 9efb158f5dd..0389af23906 100644
@@ -60,28 +60,6 @@ struct efi_device_path *efi_dp_next(const struct efi_device_path *dp)
 	return (struct efi_device_path *)dp;
 }
 
-int efi_dp_match(const struct efi_device_path *a,
-		 const struct efi_device_path *b)
-{
-	while (1) {
-		int ret;
-
-		ret = memcmp(&a->length, &b->length, sizeof(a->length));
-		if (ret)
-			return ret;
-
-		ret = memcmp(a, b, a->length);
-		if (ret)
-			return ret;
-
-		a = efi_dp_next(a);
-		b = efi_dp_next(b);
-
-		if (!a || !b)
-			return 0;
-	}
-}
-
 struct efi_device_path *efi_dp_shorten(struct efi_device_path *dp)
 {
 	while (dp) {

---
base-commit: cc557af4553382f6f50e3ed62b9577054e7bc54f
change-id: 20260904-dead-190dd2512e4b

Best regards,

Signature · 1 line
Vincent.
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Vincent Stehlé

The efi_dp_match() function is unused since commit c409593d0853 ("efi_loader: fix efi_dp_find_obj()"); remove it.

Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Tom Rini <[email protected]>

---

Quoted 82 lines
 include/efi_device_path.h        | 19 -------------------
 lib/efi_loader/efi_device_path.c | 22 ----------------------
 2 files changed, 41 deletions(-)
include/efi_device_path.h +0 -6
index aae85228f68..034a476887e 100644
@@ -33,25 +33,6 @@ extern const struct efi_device_path EFI_DP_END;
  */
 struct efi_device_path *efi_dp_next(const struct efi_device_path *dp);
 
-/**
- * efi_dp_match() - Compare two device-paths
- *
- * Compare two device paths node by node. The comparison stops when an End
- * node is reached in the shorter of the two paths. This is useful, for
 example,
- * to compare a device-path representing a device with one representing a

file
- * on that device, or a device with a parent device.
- *
- * @a: Pointer to the first device path.
- * @b: Pointer to the second device path.
- * Return: An integer less than, equal to, or greater than zero if the first
- * differing node in 'a' is found, respectively, to be less than,
- * to match, or be greater than the corresponding node in 'b'. Returns 0
- * if they match up to the end of the shorter path. Compares length first,
- * then content.
- */

include/efi_device_path.h +0 -3
-int efi_dp_match(const struct efi_device_path *a,
-                const struct efi_device_path *b);
-
 /**
  * efi_dp_shorten() - shorten device-path
  *
lib/efi_loader/efi_device_path.c +0 -22
index 9efb158f5dd..0389af23906 100644
@@ -60,28 +60,6 @@ struct efi_device_path *efi_dp_next(const struct
 efi_device_path *dp)
        return (struct efi_device_path *)dp;
 }
 
-int efi_dp_match(const struct efi_device_path *a,
-                const struct efi_device_path *b)
-{
-       while (1) {
-               int ret;
-
-               ret = memcmp(&a->length, &b->length, sizeof(a->length));
-               if (ret)
-                       return ret;
-
-               ret = memcmp(a, b, a->length);
-               if (ret)
-                       return ret;
-
-               a = efi_dp_next(a);
-               b = efi_dp_next(b);
-
-               if (!a || !b)
-                       return 0;
-       }
-}
-
 struct efi_device_path *efi_dp_shorten(struct efi_device_path *dp)
 {
        while (dp) {

---
base-commit: cc557af4553382f6f50e3ed62b9577054e7bc54f
change-id: 20260904-dead-190dd2512e4b

Best regards,
--
Vincent.