[PATCH master 3/3] common: boards: wolfvision: fix handling of overlays parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux