From patchwork Sun Dec 8 10:52:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 848272 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1608528wrt; Sun, 8 Dec 2024 02:53:02 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUoM5+BXwnZHBar/XmiLZPL80agJOpgKh/9pPq9BRYnRpwYhUaNHiFwtp6qS9Ll2TY9jfkyMw==@linaro.org X-Google-Smtp-Source: AGHT+IEwxBRtcVOvYKSXaUJ3ArTTmDD9ssoL4fIIqUHEtvKgIFS5qXXjf9PDGZ3OO+CZt7WeXYKJ X-Received: by 2002:a17:907:9518:b0:aa6:552e:451e with SMTP id a640c23a62f3a-aa6552e4657mr395476366b.29.1733655181993; Sun, 08 Dec 2024 02:53:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733655181; cv=none; d=google.com; s=arc-20240605; b=CGLpk83ollcDCl0qAjaM49EyoEbJgPcisA8Ss5sXS0cwTkeJ43N0HQNUNrXfOeEx7s nEgrX3PEP/hA0RsXyv4NXTcnEhM1aoikY8r5UpfHZCtkexkiL7rRtMUQMieta0Wo7sL/ /pk60lFtDyhiZwQhU1o15qUE6sYBhbu4jMbfYEnO3TNoY3XENLz3psxkl6oZcpMcAMXM XkwWwrRWTPtVRJzwJHvaYm5yvIJOeffsVia10kuhSJayBKdplJ0jJ7/aB1IgJ5IRRo3R 8BIRBs9G43KLVZx9nTRyMCU+MRMn3+E+iQFP3IQRVmVCLSD1Ls0eiTzjPSk1fcvkNWjm BDmA== 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:dkim-signature; bh=iMp5c3d4w227EBQRr8iv9j9OVqGRaUTFIpDzyMLlBVk=; fh=xl4/3uN1P/aeBKVoOLNs3a6APypR8W4rzdBgEapZbkA=; b=ZgV9G2AFLwnCdfuRtCPa5x4HCX2EIOOAbFo2I9unXz3aVbxY6zc87deF6HeI7Be/og +sYtnRL3Si/pAsA56tVeUFULuN1mLTWGoJ7nuLN65oucMpSYaCp35xP7mkWcY2Yboxbd lBEgvTM/AUAQPhyixp2WaHvdvsWamBY+5P9ZiOkQOGnIv11d3gauvEn/Z6EIYxgcm91U HTpb+4V/nLzZ/533x1/tL9N9fcS7sxPwWfCHM2oLlaNveE6BdERaC2QtViNcbMvBi1SU syfBLLuj/9/DC0vlQLYDQ45/hBlI+166mY1N59ZvE681Pa1GnwAmZ4OHNVSFZyhjOHAd J7qQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FY6gCDCz; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@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 a640c23a62f3a-aa67ce11b99si55292666b.360.2024.12.08.02.53.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 02:53:01 -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; dkim=pass header.i=@linaro.org header.s=google header.b=FY6gCDCz; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 70CDA89515; Sun, 8 Dec 2024 11:52:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="FY6gCDCz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1BD6B89515; Sun, 8 Dec 2024 11:52:48 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1D2A38954B for ; Sun, 8 Dec 2024 11:52:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a9a68480164so447443666b.3 for ; Sun, 08 Dec 2024 02:52:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733655165; x=1734259965; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iMp5c3d4w227EBQRr8iv9j9OVqGRaUTFIpDzyMLlBVk=; b=FY6gCDCzAugb3eYYtNcCGLeq2PQewYJgZngDZ4v4CbbdLF0TCm1oB51MxHZ0itFEH8 YxSklHb6mkTZo2EZOrjvYK1JqLvMKYAFZnUm5zamfsk3Y/TIbPRivCoaxS/DhUrImbKZ Oh2DP2aBI32dBDhz0fK15U+B5vCYNjqDudRRYe/UWN+9lcjubcNjKA5DJcF9NiBCov6H oY7W99pD0SxpGk/Eu7SDVs0UqjB5JbTHzEpks2L9ebGRlh6GnY2dVFbZr4XG7rIq5P2w Zen7F5M/Vi3dLEZZtleKRqJ+HnpLwEZQRaHh3YBsO69nirdbw+YQtUmK55sHYvY75JqG zCRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733655165; x=1734259965; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iMp5c3d4w227EBQRr8iv9j9OVqGRaUTFIpDzyMLlBVk=; b=JFZQFPtfPzAwl4/j0twjfGItZv2HWRpQ6AmDBjxXCGzCdj02kMdCqDpUa/cDM2fRJm 7yC8ll59e6O5ZUv2EvAb37F9FerjpLTKG955uUjsxxLom0VhUB3EaaEZ1V32Xeb/mWu+ 1OvWsmni95VCCvc3sEyUUwjofoGz1uGGq6rkwRaoi4M9pI5dYHEMLoOXJvzuTgARQxN6 GSoqqUhy7JqLYtlq0unImLjjcwSLO3tiiXuJ+lWEpwQcnXK7FZVZydnK+81v3EzOklIP sS2afz3ugBh+cM5FV2eUs/rNY3LaE5B/WXQgFSo9tSsNL0LZu6SiqgVMU7Iz1aelKXDi v6Og== X-Forwarded-Encrypted: i=1; AJvYcCV6qLzFjWkLA2zSX3u6kkTveXvbmPZshYQq12mpS3vHEBdgjPAn1VfCbthl1WKfOcwgnK06OlM=@lists.denx.de X-Gm-Message-State: AOJu0YxEKSaTZVVwiyCgN1vUsYM29AAUDmmdMbsJ07Mo05UCxaWDXX0j LnCz+KcGDHLDngnO86EZslfwFDCYCgUCkA4IK02d1Me4wVu2p5djaO42nnHLJvg= X-Gm-Gg: ASbGncs8Oo5tL90e9KrllVyGhehCs8LhdxI3iMIkXabjmfVVgZtLK+dqSLT0v8ACD6t hWrHZIiZ4/X4/9xJPQ7VJ0sqzCLR+WX9y30z/j71vzmvzIrsMzNRtJO1hL6QbfHSo/R4O4nCHiy NE4ca9T18zVi0T36hQ8ZOMsfpwHQdT2IVcgf6iaYk3KFUXvnb7SjBk5aq/0GLtgJgANIhMI2yKK AzqLo+xkYELbyzfrUjaQdGMMyOgulUsYpoSnlMRtESvdpA/kKULAyaPQVKUQonPh3JxMj6m2FoZ l6rSgDFzFAy/Dr5fyJuDuONvMU4= X-Received: by 2002:a17:906:1da1:b0:a9a:161:8da4 with SMTP id a640c23a62f3a-aa63a2432c6mr699458266b.55.1733655165437; Sun, 08 Dec 2024 02:52:45 -0800 (PST) Received: from localhost.localdomain (ppp176092181030.access.hol.gr. [176.92.181.30]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa625e92fe3sm517768566b.51.2024.12.08.02.52.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 02:52:45 -0800 (PST) From: Ilias Apalodimas To: xypron.glpk@gmx.de, trini@konsulko.com Cc: Ilias Apalodimas , =?utf-8?q?Marek_Beh?= =?utf-8?q?=C3=BAn?= , Simon Glass , Sughosh Ganu , Marek Vasut , Mattijs Korpershoek , Peter Korsgaard , Roman Stratiienko , Laurent Pinchart , Matthias Schiffer , Dario Binacchi , Nam Cao , AKASHI Takahiro , Janne Grunau , Caleb Connolly , u-boot@lists.denx.de Subject: [RFC PATCH 2/7] lmb: Simplify lmb_addrs_overlap() Date: Sun, 8 Dec 2024 12:52:05 +0200 Message-ID: <20241208105223.2821049-3-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241208105223.2821049-1-ilias.apalodimas@linaro.org> References: <20241208105223.2821049-1-ilias.apalodimas@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 There's no point subtracting -1 from the calculated addresses and then check for a <= b. Just remove the -1 and check for a < b. Signed-off-by: Ilias Apalodimas --- lib/lmb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/lmb.c b/lib/lmb.c index a7ecbb58831f..c7bf5120696f 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -36,10 +36,10 @@ DECLARE_GLOBAL_DATA_PTR; static long lmb_addrs_overlap(phys_addr_t base1, phys_size_t size1, phys_addr_t base2, phys_size_t size2) { - const phys_addr_t base1_end = base1 + size1 - 1; - const phys_addr_t base2_end = base2 + size2 - 1; + const phys_addr_t base1_end = base1 + size1; + const phys_addr_t base2_end = base2 + size2; - return ((base1 <= base2_end) && (base2 <= base1_end)); + return ((base1 < base2_end) && (base2 < base1_end)); } static long lmb_addrs_adjacent(phys_addr_t base1, phys_size_t size1,