[PATCH master 3/3] common: boards: wolfvision: fix handling of overlays parameter
Michael Riesch
michael.riesch at wolfvision.net
Wed May 15 01:32:36 PDT 2024
Hi all,
On 5/15/24 10:00, Michael Riesch wrote:
> 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 at 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("");
Hm, apparently this gives a compiler warning "warning: zero-length
gnu_printf format string [-Wformat-zero-length]".
... = basprintf("%s", ""); ???
Best regards,
Michael
> +
> for (i = 0; i < num_extensions; i++) {
> const struct wv_rk3568_extension *extension = &extensions[i];
> const struct wv_overlay *overlay;
>
More information about the barebox
mailing list