From: Michael Riesch <michael.riesch@wolfvision.net>
To: barebox@lists.infradead.org
Cc: Michael Riesch <michael.riesch@wolfvision.net>
Subject: [PATCH master v2 3/3] common: boards: wolfvision: fix handling of overlays parameter
Date: Wed, 15 May 2024 12:35:57 +0200 [thread overview]
Message-ID: <20240515-b4-pf5-fixup-v2-3-7c2aff3f7465@wolfvision.net> (raw)
In-Reply-To: <20240515-b4-pf5-fixup-v2-0-7c2aff3f7465@wolfvision.net>
If the char **overlays parameter to wolfvision_rk3568_detect_hw is NULL,
the overlay file names are not collected.
If overlays points to a NULL pointer, it is initialized properly with
an empty string. This is convenient as the call to
globalvar_set("of.overlay.filepattern", my_resulting_string);
that usually follows actually resets the global filepattern variable
from its default "*" to "". Thereby, a paradoxical situation in which no
extensions are detected but all available overlays are applied (due to "*")
is avoided.
Nevertheless, it is still possible to pass an existing string to this
method and let the method append overlay file names.
Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
---
common/boards/wolfvision/common.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/common/boards/wolfvision/common.c b/common/boards/wolfvision/common.c
index f483918cec..08836096b9 100644
--- a/common/boards/wolfvision/common.c
+++ b/common/boards/wolfvision/common.c
@@ -20,7 +20,7 @@ int wolfvision_apply_overlay(const struct wv_overlay *overlay, char **files)
{
int ret;
- if (overlay->filename) {
+ if (overlay->filename && files) {
if (*files) {
char *old = *files;
*files = basprintf("%s %s", old, overlay->filename);
@@ -115,6 +115,9 @@ int wolfvision_rk3568_detect_hw(const struct wv_rk3568_extension *extensions,
if (ret)
return ret;
+ if (overlays && !*overlays)
+ *overlays = xstrdup("");
+
for (i = 0; i < num_extensions; i++) {
const struct wv_rk3568_extension *extension = &extensions[i];
const struct wv_overlay *overlay;
--
2.34.1
next prev parent reply other threads:[~2024-05-15 10:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-15 10:35 [PATCH master v2 0/3] Fixes for WolfVision board code library and PF5 mainboard code Michael Riesch
2024-05-15 10:35 ` [PATCH master v2 1/3] arm: boards: add pr_fmt() prefix to wolfvision pf5 board code Michael Riesch
2024-05-15 10:35 ` [PATCH master v2 2/3] common: boards: move dependencies to wolfvision board code library Michael Riesch
2024-05-15 10:35 ` Michael Riesch [this message]
2024-05-16 6:11 ` [PATCH master v2 0/3] Fixes for WolfVision board code library and PF5 mainboard code 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=20240515-b4-pf5-fixup-v2-3-7c2aff3f7465@wolfvision.net \
--to=michael.riesch@wolfvision.net \
--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