From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master 1/3] resource: return NULL for error in request_barebox_region
Date: Mon, 22 Jul 2024 19:06:04 +0200 [thread overview]
Message-ID: <20240722170606.3866957-1-a.fatoum@pengutronix.de> (raw)
The function currently returns NULL for error if the range is in SDRAM
and couldn't be requested or an error pointer if the range is outside.
Reduce the confusion by using only one way to indicate error. As
request_barebox_region is used to replace request_sdram_region calls and
that returns NULL on error, follow suit.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
common/memory.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/common/memory.c b/common/memory.c
index eb7838d03613..c155cb317f25 100644
--- a/common/memory.c
+++ b/common/memory.c
@@ -84,9 +84,12 @@ struct resource *request_barebox_region(const char *name,
resource_size_t end = start + size - 1;
if (barebox_res && barebox_res->start <= start &&
- end <= barebox_res->end)
- return __request_region(barebox_res, start, end,
- name, IORESOURCE_MEM);
+ end <= barebox_res->end) {
+ struct resource *iores;
+ iores = __request_region(barebox_res, start, end,
+ name, IORESOURCE_MEM);
+ return !IS_ERR(iores) ? iores : NULL;
+ }
return request_sdram_region(name, start, size);
}
--
2.39.2
next reply other threads:[~2024-07-22 17:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-22 17:06 Ahmad Fatoum [this message]
2024-07-22 17:06 ` [PATCH master 2/3] ARM: i.MX8M: scratch: fix initcall return code on request_barebox_region error Ahmad Fatoum
2024-07-22 17:06 ` [PATCH master 3/3] RISC-V: cpu: " Ahmad Fatoum
2024-07-22 17:49 ` [PATCH master 1/3] resource: return NULL for error in request_barebox_region Marco Felsch
2024-07-23 6:07 ` Ahmad Fatoum
2024-07-24 8:08 ` 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=20240722170606.3866957-1-a.fatoum@pengutronix.de \
--to=a.fatoum@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