From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 01/10] bootm: set image_data::initrd_res at a single place
Date: Mon, 5 Jan 2026 09:03:33 +0100 [thread overview]
Message-ID: <20260105080653.3240497-2-a.fatoum@barebox.org> (raw)
In-Reply-To: <20260105080653.3240497-1-a.fatoum@barebox.org>
We are going to substantially rework this function, so make it easier to
reason about by setting the externally visible image_data->initrd_res
only at the end.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
common/bootm.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/common/bootm.c b/common/bootm.c
index 4e4d940d9198..e60c81a9021e 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -339,6 +339,7 @@ static int bootm_open_initrd_uimage(struct image_data *data)
const struct resource *
bootm_load_initrd(struct image_data *data, unsigned long load_address)
{
+ struct resource *res;
enum filetype type;
int ret;
@@ -362,10 +363,9 @@ bootm_load_initrd(struct image_data *data, unsigned long load_address)
ERR_PTR(ret));
return ERR_PTR(ret);
}
- data->initrd_res = request_sdram_region("initrd",
- load_address, initrd_size,
- MEMTYPE_LOADER_DATA, MEMATTRS_RW);
- if (!data->initrd_res) {
+ res = request_sdram_region("initrd", load_address, initrd_size,
+ MEMTYPE_LOADER_DATA, MEMATTRS_RW);
+ if (!res) {
pr_err("unable to request SDRAM region for initrd at"
" 0x%08llx-0x%08llx\n",
(unsigned long long)load_address,
@@ -397,16 +397,15 @@ bootm_load_initrd(struct image_data *data, unsigned long load_address)
num = uimage_part_num(data->initrd_part);
- data->initrd_res = uimage_load_to_sdram(data->initrd,
- num, load_address);
- if (!data->initrd_res)
+ res = uimage_load_to_sdram(data->initrd, num, load_address);
+ if (!res)
return ERR_PTR(-ENOMEM);
goto done;
}
- data->initrd_res = file_to_sdram(data->initrd_file, load_address, MEMTYPE_LOADER_DATA);
- if (!data->initrd_res)
+ res = file_to_sdram(data->initrd_file, load_address, MEMTYPE_LOADER_DATA);
+ if (!res)
return ERR_PTR(-ENOMEM);
done:
@@ -417,10 +416,9 @@ bootm_load_initrd(struct image_data *data, unsigned long load_address)
pr_info(", multifile image %s", data->initrd_part);
pr_info("\n");
done1:
- pr_info("initrd is at %pa-%pa\n",
- &data->initrd_res->start,
- &data->initrd_res->end);
+ pr_info("initrd is at %pa-%pa\n", &res->start, &res->end);
+ data->initrd_res = res;
return data->initrd_res;
}
--
2.47.3
next prev parent reply other threads:[~2026-01-05 8:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-05 8:03 [PATCH 00/10] bootm: refactor to prepare multiple initrd support Ahmad Fatoum
2026-01-05 8:03 ` Ahmad Fatoum [this message]
2026-01-05 8:03 ` [PATCH 02/10] bootm: fit: split support into dedicated file Ahmad Fatoum
2026-01-05 8:03 ` [PATCH 03/10] bootm: uimage: " Ahmad Fatoum
2026-01-05 8:03 ` [PATCH 04/10] filetype: introduce filetype_fit Ahmad Fatoum
2026-01-05 8:03 ` [PATCH 05/10] bootm: refactor for readability and extensibility Ahmad Fatoum
2026-01-05 8:03 ` [PATCH 06/10] memory: move release_sdram_region into header Ahmad Fatoum
2026-01-05 8:03 ` [PATCH 07/10] resource: make NULL in release_[sdram_]region a no-op Ahmad Fatoum
2026-01-05 8:03 ` [PATCH 08/10] common: elf: use release_region unconditionally Ahmad Fatoum
2026-01-05 8:03 ` [PATCH 09/10] memory: always print errors on request_sdram_region failure Ahmad Fatoum
2026-01-05 8:03 ` [PATCH 10/10] memory: drop now duplicate request_sdram_region error messages Ahmad Fatoum
2026-01-09 8:20 ` [PATCH 00/10] bootm: refactor to prepare multiple initrd support Sascha Hauer
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=20260105080653.3240497-2-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--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