mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Michael Riesch <michael.riesch@wolfvision.net>,
	Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH master 3/3] common: boards: wolfvision: fix handling of overlays parameter
Date: Wed, 15 May 2024 11:14:43 +0200	[thread overview]
Message-ID: <4230607b-02bb-470f-bc8d-5968045f833e@pengutronix.de> (raw)
In-Reply-To: <24dd4224-2eb0-4e04-9d5d-9650901fb3e5@wolfvision.net>

On 15.05.24 10:32, Michael Riesch wrote:
> 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@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", ""); ???

xstrdup("")

> 
> Best regards,
> Michael
> 
>> +
>>  	for (i = 0; i < num_extensions; i++) {
>>  		const struct wv_rk3568_extension *extension = &extensions[i];
>>  		const struct wv_overlay *overlay;
>>
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




  reply	other threads:[~2024-05-15  9:15 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 ` [PATCH master 3/3] common: boards: wolfvision: fix handling of overlays parameter Michael Riesch
2024-05-15  8:32   ` Michael Riesch
2024-05-15  9:14     ` Ahmad Fatoum [this message]
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=4230607b-02bb-470f-bc8d-5968045f833e@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=michael.riesch@wolfvision.net \
    /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