From patchwork Wed Jul 24 06:02:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 814158 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp2619882wro; Tue, 23 Jul 2024 23:12:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW1JqpaJY0OPjgAqLQ8gVthdqgVedP7pmYm8QjI+t7Nsbn0Kg9GZ52sNJBrVKaHIs2igRNU1GF1yotaFoPvr5y+ X-Google-Smtp-Source: AGHT+IGzClh4G7iDQdRhu1MUtOPs0f4RQyUIOR67LCtbm5l/Z9RKJyUBjBXo2QfMUyqFZFuOH+dM X-Received: by 2002:adf:e848:0:b0:368:747c:5a04 with SMTP id ffacd0b85a97d-369f5a8f0a4mr641318f8f.25.1721801526965; Tue, 23 Jul 2024 23:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721801526; cv=none; d=google.com; s=arc-20160816; b=ISVdlgtm/XO1W7CENmZ0yQbqi5sozQlbvWdXhbe/rxauK6l9Z3JLA8c9GODd2n578Q 90T/i/QTDBzoT009tpkEhuVB2gE04uF4lTT7WCQF+8wR7R5maukEAQX5YvQkFV35lDOo ff2+/O4MRkrBODrwyUa50QBBezKDDcy0NrRSdYOCZ+Og7oIEt1oHw8zFnKPuscu09vpi AzmZ57xcrzJvMFSrKmWDhRuhDfLBkpVHuV/vXqNd+jV1cJdVdNq13WkAIxA0SfowgpaO AynYjArXsuJKEUgQ5d7v0t1emwG/Os9G51Fp3ZIR3VtcGpq7S1aICw3rIANzzRcFwy4o POKQ== 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=1LRwFN6rp/WBq3uAyRjksPfVf+3t4Zz+KqFW02Wcl80=; fh=eimiGswTlodK8yi2DcDfSicmKwvq5bxKQKpD+SkkTNY=; b=gX3WnwERZGiBbkbIuAUYLMr+PmZB0493I37opyui/wPZI+FYFvhN9usN7ilTvtlwJ5 fAVzqhOZuHQBeD2yFd0aM+cffAuZWbKTILxjwMwg3aUJgwC4H5cUvRHAf4Y9MOl7cQyy Pxf8mvURgDiaC/tL142pUerVUe1dqlsR9NafLDV/djqx8VSaNFZYsawAAXocs65uIa6k pBBchfuHswVY0FbbmyhBzHxMPTP7JKEsMX+OGyNgh7Auoao0lD93uRY4zlVIUS5f3dwv ogcrGmh90ZSimut1CdYnAqr6Av5E2KB6BCEiakQFfIsY/d2kET5Bced6Os9AGykSID3x uSIQ==; 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 ffacd0b85a97d-369e365d8desi1331915f8f.165.2024.07.23.23.12.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 23:12:06 -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 529EC88977; Wed, 24 Jul 2024 08:05:51 +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 BBA7F88896; Wed, 24 Jul 2024 08:05:47 +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.9 required=5.0 tests=BAYES_00, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, SPF_HELO_NONE,T_SPF_TEMPERROR autolearn=ham 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 91CF588906 for ; Wed, 24 Jul 2024 08:05:39 +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 8224514BF; Tue, 23 Jul 2024 23:05:59 -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 70B973F766; Tue, 23 Jul 2024 23:05:29 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Marek Vasut , Mark Kettenis , Michal Simek , Patrick DELAUNAY , Patrice CHOTARD , Huan Wang , Angelo Dureghello , Daniel Schwierzeck , Thomas Chou , Rick Chen , Max Filippov , Sughosh Ganu Subject: [PATCH 33/40] test: cedit: use allocated address for reading file Date: Wed, 24 Jul 2024 11:32:17 +0530 Message-Id: <20240724060224.3071065-34-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240724060224.3071065-1-sughosh.ganu@linaro.org> References: <20240724060224.3071065-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 rfc: None 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..6078b7cc0f 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, LMB_NONE); + 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, LMB_NONE); ut_asserteq(ID_CPU_SPEED_2, ofnode_read_u32_default(node, "cpu-speed", 0));