From patchwork Mon Mar 3 13:32:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 869834 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1561:b0:38f:210b:807b with SMTP id 1csp2122415wrz; Mon, 3 Mar 2025 05:33:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXlt5th3sRUUbEmC0aTWEjAhDh6IBbgQuLRQM6B2IOjG5osstCiMUlXrxTshfsmMbwXAWfvHQ==@linaro.org X-Google-Smtp-Source: AGHT+IEzfo+7lbmHu62Cm3VPWDWRhockbSIlMvQjN+6L0hnumCVhnhCsf2d7nNaj2pY2JaNYFCA7 X-Received: by 2002:a05:6a21:1518:b0:1ee:68e3:ff45 with SMTP id adf61e73a8af0-1f2f4e4c740mr25213570637.35.1741008812787; Mon, 03 Mar 2025 05:33:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1741008812; cv=none; d=google.com; s=arc-20240605; b=aCodzB1P89KLKNZoLUqek0nctCrNx36KJbBABv84TI+saKOzckqpFK/dC9YpiuAycP WEi4efH4E0RGpr/3uz/nGzxwFilSUPM3xT1U0SLoHHOE0BGS0wkVzzxDRgCXGNIbtPTt FMvvVeVCIxY4Q4ocs2El1feXayryeQVmAF5QU/oOgziPynO7Q4QZsgKld3h2aUPqYrtM smj9KR/7wHdz8iBuEr5bfQ3WBf48ZiXlBJdXkqa8Ft47CEVyeX4s+Oq8JWnaiUzt2ASX P2Jz5Z3NXhbpctLDi53XWrExQTGSlNP6iFGryo2ibY56WS0trBz2FhoaI6OhKp4D7N32 s7MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=2nfI1dXARh/XFigsWfRy5RMxb90eyWenlaYK5g7DPlA=; fh=2HGKihHUAicyV3F+aHiaoPpwvqWA0zlC04Ew6QaQoEg=; b=Ue3XWjCPZEHSa6z69Ks6ewC7YGgqFe0Wf0QiUEqPpvlu0Ti+PTgrNGyYfHx6RZSTlm 5mfiNhHIzrlBpuPjMSvHcl5/w0owRwdrwtHa7acGoEVM381fHDq2YeB627j9ayGVy4Mo lMudgx2OW4ISxwoVUOfAuULTj5LxiqXEk+51di/7lFGDLpMFBgk/dQJb2ZCExMNqLav/ XESaCuSEocB/2uKMn8yb9fsSpNRq7lBiYFfsTL7733ihL6riSrlxfJ9GlDggCXCooogK oBKVMI2u/1qo1KM7S68lE9PMhrotxnJ0Wkj0fqDcZaRHLEb/taojcW91aUyrmAvGZ4DX lmug==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 41be03b00d2f7-aee7ddf2a85si14112120a12.134.2025.03.03.05.33.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Mar 2025 05:33:32 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 170C88128D; Mon, 3 Mar 2025 14:33:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 2124E81298; Mon, 3 Mar 2025 14:33:05 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 1B49081280 for ; Mon, 3 Mar 2025 14:33:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9CEC4106F; Mon, 3 Mar 2025 05:33:16 -0800 (PST) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 04ABC3F673; Mon, 3 Mar 2025 05:32:59 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Simon Glass , Tom Rini , Quentin Schulz , Udit Kumar , Heinrich Schuchardt , Sughosh Ganu Subject: [PATCH v3 3/6] lmb: check for a region's coalescing with all existing regions Date: Mon, 3 Mar 2025 19:02:28 +0530 Message-Id: <20250303133231.405279-4-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250303133231.405279-1-sughosh.ganu@linaro.org> References: <20250303133231.405279-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The lmb_add_region_flags() first checks if the new region to be added can be coalesced with existing regions. The check stops if the two regions are adjecent but their flags do not match. However, it is possible that the newly added region might be adjacent with the next existing region and with matching flags. Check for this possibility by not breaking out of the loop. Signed-off-by: Sughosh Ganu Reviewed-by: Heinrich Schuchardt --- Changes since V2: None lib/lmb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lmb.c b/lib/lmb.c index 26d9cafef41..53af96fa2a9 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -190,7 +190,7 @@ static long lmb_add_region_flags(struct alist *lmb_rgn_lst, phys_addr_t base, break; } else if (ret < 0) { if (flags != rgnflags) - break; + continue; rgn[i].size += size; coalesced++; break;