[PATCH 2/2] FIT: do not cache uncompressed data

Sascha Hauer s.hauer at pengutronix.de
Thu Oct 1 00:11:21 PDT 2026


This effectively reverts commit b1babdb15cf0 ("FIT: cache uncompressed
data").

That commit kept the decompressed data around, so that device trees
decompressed to match their compatible did not have to be decompressed
again later. Since commit 5d7d60c4961c ("FIT: do not decompress device
trees to find compatible") compressed device trees are no longer used
for compatible matching, and the FIT loadables now cache the opened
image themselves, so nothing benefits from the cache anymore.

The decompressed buffer is still attached to the image node, so that it
is freed together with the FIT.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/image-fit.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/common/image-fit.c b/common/image-fit.c
index d16d805d53..fdd4b271cc 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -754,7 +754,6 @@ static int fit_handle_decompression(struct device_node *image,
 				    int *data_len)
 {
 	const char *compression;
-	struct property *pp;
 	void *uc_data;
 	int ret;
 
@@ -774,21 +773,18 @@ static int fit_handle_decompression(struct device_node *image,
 		return -ENOSYS;
 	}
 
-	pp = of_find_property(image, "$uncompressed-data", NULL);
-	if (!pp) {
-		ret = uncompress_buf_to_buf(*data, *data_len, &uc_data,
-					    fit_uncompress_error_fn);
-		if (ret < 0) {
-			pr_err("%s data couldn't be decompressed\n", compression);
-			return ret;
-		}
-
-		/* associate buffer with FIT, so it's not leaked */
-		pp = __of_new_property(image, "$uncompressed-data", uc_data, ret);
+	ret = uncompress_buf_to_buf(*data, *data_len, &uc_data,
+				    fit_uncompress_error_fn);
+	if (ret < 0) {
+		pr_err("%s data couldn't be decompressed\n", compression);
+		return ret;
 	}
 
-	*data = of_property_get_value(pp);
-	*data_len = pp->length;
+	*data = uc_data;
+	*data_len = ret;
+
+	/* associate buffer with FIT, so it's not leaked */
+	__of_new_property(image, "$uncompressed-data", uc_data, *data_len);
 
 	return 0;
 }

-- 
2.47.3




More information about the barebox mailing list