From: Sascha Hauer <s.hauer@pengutronix.de>
To: BAREBOX <barebox@lists.infradead.org>
Subject: [PATCH 2/2] FIT: do not cache uncompressed data
Date: Thu, 01 Oct 2026 09:11:21 +0200 [thread overview]
Message-ID: <20261001-fit-cache-fixes-v1-2-568bd214e5b0@pengutronix.de> (raw)
In-Reply-To: <20261001-fit-cache-fixes-v1-0-568bd214e5b0@pengutronix.de>
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@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
prev parent reply other threads:[~2026-10-01 7:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 7:11 [PATCH 0/2] FIT: Do not hash image data twice Sascha Hauer
2026-10-01 7:11 ` [PATCH 1/2] bootm: fit: open FIT images only once per loadable Sascha Hauer
2026-10-01 7:11 ` Sascha Hauer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261001-fit-cache-fixes-v1-2-568bd214e5b0@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox