diff mbox series

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

Message ID 20240306134906.1179285-5-avromanov@salutedevices.com
State Superseded
Delegated to: Dario Binacchi
Headers show
Series Introduce UBI block device | expand

Commit Message

Alexey Romanov March 6, 2024, 1:49 p.m. UTC
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@salutedevices.com>
---
 disk/part.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Heiko Schocher March 23, 2024, 5:04 a.m. UTC | #1
Hello Alexey,

On 06.03.24 14:49, Alexey Romanov wrote:
> 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@salutedevices.com>
> ---
>   disk/part.c | 7 +++++++
>   1 file changed, 7 insertions(+)

Reviewed-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
diff mbox series

Patch

diff --git a/disk/part.c b/disk/part.c
index 0fc5cc0419..362c9de609 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -285,6 +285,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;