[PATCH v5 4/6] disk: don't try search for partition type if already set

Alexey Romanov avromanov at salutedevices.com
Wed Jun 26 12:45:25 CEST 2024


Block devices can already set partition type at initialization
stage, so, in this case is no point in searching for partition type.

Signed-off-by: Alexey Romanov <avromanov at salutedevices.com>
Reviewed-by: Heiko Schocher <hs at denx.de>
---
 disk/part.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/disk/part.c b/disk/part.c
index 3f0fce5cfa..0aced6eb72 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -286,6 +286,13 @@ void part_init(struct blk_desc *desc)
 
 	blkcache_invalidate(desc->uclass_id, desc->devnum);
 
+	if (desc->part_type != PART_TYPE_UNKNOWN) {
+		for (entry = drv; entry != drv + n_ents; entry++) {
+			if (entry->part_type == desc->part_type && !entry->test(desc))
+				return;
+		}
+	}
+
 	desc->part_type = PART_TYPE_UNKNOWN;
 	for (entry = drv; entry != drv + n_ents; entry++) {
 		int ret;
-- 
2.34.1



More information about the U-Boot mailing list