From: Pali Rohár Date: Mon, 1 Aug 2022 10:02:19 +0000 (+0200) Subject: arm: mvebu: turris_omnia: Do not fail in fixup_mtd_partitions when partitions do... X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=37af2c7b296c66bd463943a3193df3c5e085a738;p=u-boot.git arm: mvebu: turris_omnia: Do not fail in fixup_mtd_partitions when partitions do not exist All partitions are created by fixup_mtd_partitions() function, so they do not have to exist just for their removal need. Fixes: 92f36c8e74c1 ("arm: mvebu: turris_omnia: fixup MTD partitions in Linux' DTB") Signed-off-by: Pali Rohár Reviewed-by: Stefan Roese Reviewed-by: Marek Behún --- diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index a7c1c1fc79..796c55f3c6 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -974,11 +974,10 @@ static bool fixup_mtd_partitions(void *blob, int offset, struct mtd_info *mtd) int parts; parts = fdt_subnode_offset(blob, offset, "partitions"); - if (parts < 0) - return false; - - if (fdt_del_node(blob, parts) < 0) - return false; + if (parts >= 0) { + if (fdt_del_node(blob, parts) < 0) + return false; + } parts = fdt_add_subnode(blob, offset, "partitions"); if (parts < 0)