From patchwork Wed Aug 14 11:00:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 819130 Delivered-To: patch@linaro.org Received: by 2002:adf:cd01:0:b0:367:895a:4699 with SMTP id w1csp646420wrm; Wed, 14 Aug 2024 04:05:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWohEmqba0se+GRRPbltBkiiPpYcNauQ7UZ81+A6EMVm6AZv3Hf0OdXs3EsQaD7bAKJYHfuFaPspOqOfzWYhvGi X-Google-Smtp-Source: AGHT+IE8QkwgZHMUCHcqngLes+sn8IEDjpdNuezBaRZmhSJ7LE72Tk29dOmlx+NaXPK4mz9XB6eX X-Received: by 2002:a17:907:f143:b0:a7a:8e0f:aaed with SMTP id a640c23a62f3a-a8366fefc47mr158458066b.50.1723633529098; Wed, 14 Aug 2024 04:05:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723633529; cv=none; d=google.com; s=arc-20160816; b=HIDgyoit4xUEqTPhpZ5W6vVrSax82BmdG+DmclpQo4Sn41MIOV7MKxLW17hT9Dyhf1 fsi+hKfbsFLDBs3NRV93lKmkumIynNlQclDPyX2coTF2V81K8X/3s2zRE9llNVyoa81J Zk8+6qU7dXsJhsNfxOEPl5nVlTDOqUEVjFqdhnGK9+YBgfXWwT7rrnS4bcPClTEn2+gt sAqeFYk8tGYZEMZJvJ/zoxgtNu5XZ0VsQctey0/yQsaZ7rMmxxAwxaNZ1+n/BL5bPyIL biYFCVtDgJlFbb9Ie/oOU80O1SpksF1ekBDHttsYLURPKfycvAimnEj8hR2ItU1VvMKm XhPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=3YifyNONnudGvCKDJKMxDxsPvV+O5HgXyczrxr1G4dY=; fh=w4WyT9xL7ErtT1TeetrD/m0Y0mAgjnERgxacGUpGjSg=; b=hVNcGIMN7WMK168fgNo39RpitvRiZjMtLC79zRY3ht1ADYAh4quTCFWMvINlAFdIXT Miei3kXhmUyz0G+IPc+8DZwcfi4jagt29sE9GIo5AawqQTqFVEwLc5z7BKasFU21e/q9 CgQXQrZKlGLTjYc11i521IMSFJJWUUcJkKK8JjfSUWaMmNhEHFFmDPvNqkUaMZFQEt0i dZp+vzylLdsPCTqThFmNDWQGDrFcmNiD+grRfCuhtBoyDgdm8YFB6aca2mo+fxorEkG9 N8OHr+Ha5VcKfgB7Q5xpvgfREr2lWXwXmnu4dOEoklN7KXTThiCBfdYbJx8ata1BIo8v S5zQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-a80f4150c0esi197482666b.600.2024.08.14.04.05.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 04:05:29 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 49FBB889BD; Wed, 14 Aug 2024 13:02:52 +0200 (CEST) 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 2366E88A77; Wed, 14 Aug 2024 13:02:51 +0200 (CEST) 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_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, SPF_HELO_NONE,SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE 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 0976C88A0D for ; Wed, 14 Aug 2024 13:02:49 +0200 (CEST) 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 6E2D2DA7; Wed, 14 Aug 2024 04:03:14 -0700 (PDT) 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 EEE793F58B; Wed, 14 Aug 2024 04:02:43 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Marek Vasut , Tom Rini , Mark Kettenis , Michal Simek , Patrick DELAUNAY , Patrice CHOTARD , Huan Wang , Angelo Dureghello , Daniel Schwierzeck , Thomas Chou , Rick Chen , Max Filippov , Sughosh Ganu Subject: [PATCH v2 27/32] test: cedit: use allocated address for reading file Date: Wed, 14 Aug 2024 16:30:04 +0530 Message-Id: <20240814110009.45310-28-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240814110009.45310-1-sughosh.ganu@linaro.org> References: <20240814110009.45310-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 Instead of a randomly selected address, use an LMB allocated one for reading the file into memory. With the LMB map now being persistent and global, the address used for reading the file might be already allocated as non-overwritable, resulting in a failure. Get a valid address from LMB and then read the file to that address. Signed-off-by: Sughosh Ganu --- Changes since V1: * Don't use the API version with flags parameter. test/boot/cedit.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/boot/cedit.c b/test/boot/cedit.c index fd19da0a0c..923ddd1481 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -61,7 +62,7 @@ static int cedit_fdt(struct unit_test_state *uts) struct video_priv *vid_priv; extern struct expo *cur_exp; struct scene_obj_menu *menu; - ulong addr = 0x1000; + ulong addr; struct ofprop prop; struct scene *scn; oftree tree; @@ -86,6 +87,8 @@ static int cedit_fdt(struct unit_test_state *uts) str = abuf_data(&tline->buf); strcpy(str, "my-machine"); + addr = lmb_alloc(1024, 1024); + ut_asserteq(!!addr, !0); ut_assertok(run_command("cedit write_fdt hostfs - settings.dtb", 0)); ut_assertok(run_commandf("load hostfs - %lx settings.dtb", addr)); ut_assert_nextlinen("1024 bytes read"); @@ -94,6 +97,7 @@ static int cedit_fdt(struct unit_test_state *uts) tree = oftree_from_fdt(fdt); node = ofnode_find_subnode(oftree_root(tree), CEDIT_NODE_NAME); ut_assert(ofnode_valid(node)); + lmb_free(addr, 1024); ut_asserteq(ID_CPU_SPEED_2, ofnode_read_u32_default(node, "cpu-speed", 0));