mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Michael Riesch <michael.riesch@wolfvision.net>
To: barebox@lists.infradead.org
Cc: Michael Riesch <michael.riesch@wolfvision.net>
Subject: [PATCH master 3/3] common: boards: wolfvision: fix handling of overlays parameter
Date: Wed, 15 May 2024 10:00:36 +0200	[thread overview]
Message-ID: <20240515-b4-pf5-fixup-v1-3-a58c8ec94f48@wolfvision.net> (raw)
In-Reply-To: <20240515-b4-pf5-fixup-v1-0-a58c8ec94f48@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..6cb76250dd 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 = basprintf("");
+
 	for (i = 0; i < num_extensions; i++) {
 		const struct wv_rk3568_extension *extension = &extensions[i];
 		const struct wv_overlay *overlay;

-- 
2.34.1




  parent reply	other threads:[~2024-05-15  8:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-15  8:00 [PATCH master 0/3] Fixes for WolfVision board code library and PF5 mainboard code Michael Riesch
2024-05-15  8:00 ` [PATCH master 1/3] arm: boards: add pr_fmt() prefix to wolfvision pf5 board code Michael Riesch
2024-05-15  8:00 ` [PATCH master 2/3] common: boards: move dependencies to wolfvision board code library Michael Riesch
2024-05-15  8:00 ` Michael Riesch [this message]
2024-05-15  8:32   ` [PATCH master 3/3] common: boards: wolfvision: fix handling of overlays parameter Michael Riesch
2024-05-15  9:14     ` Ahmad Fatoum
2024-05-15 10:28       ` Michael Riesch

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-v1-3-a58c8ec94f48@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