* [PATCH v1] of: add sanity check for machine compatible string
@ 2024-05-29 9:33 Oleksij Rempel
2024-05-29 10:30 ` Ahmad Fatoum
2024-05-30 13:27 ` Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Oleksij Rempel @ 2024-05-29 9:33 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
Add a sanity check in of_get_machine_compatible to ensure we fall back
to the default hostname "barebox" when the machine compatible string is
empty. This prevents scenarios where no hostname is set, which can occur
when starting an STM32 version of Barebox as a second stage on top of
Barebox prior to commit 1da26bfb9da2 ("common: don't fixup empty serial/
machine_compatible strings"). This fallback makes debugging easier in
case someone faces a similar issue.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/of/base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 2213165fd7..62d84786ae 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -3416,7 +3416,7 @@ const char *of_get_machine_compatible(void)
return NULL;
p = strchr(name, ',');
- return p ? p + 1 : name;
+ return nonempty(p ? p + 1 : name);
}
EXPORT_SYMBOL(of_get_machine_compatible);
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] of: add sanity check for machine compatible string
2024-05-29 9:33 [PATCH v1] of: add sanity check for machine compatible string Oleksij Rempel
@ 2024-05-29 10:30 ` Ahmad Fatoum
2024-05-30 13:27 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-05-29 10:30 UTC (permalink / raw)
To: Oleksij Rempel, barebox
On 29.05.24 11:33, Oleksij Rempel wrote:
> Add a sanity check in of_get_machine_compatible to ensure we fall back
> to the default hostname "barebox" when the machine compatible string is
> empty. This prevents scenarios where no hostname is set, which can occur
> when starting an STM32 version of Barebox as a second stage on top of
> Barebox prior to commit 1da26bfb9da2 ("common: don't fixup empty serial/
> machine_compatible strings"). This fallback makes debugging easier in
> case someone faces a similar issue.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> drivers/of/base.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 2213165fd7..62d84786ae 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -3416,7 +3416,7 @@ const char *of_get_machine_compatible(void)
> return NULL;
>
> p = strchr(name, ',');
> - return p ? p + 1 : name;
> + return nonempty(p ? p + 1 : name);
An alternative would be return `p ? p + 1 : nonempty(name);`, but that's
not really more readable, so the current change is alright.
Thanks!
Ahmad
> }
> EXPORT_SYMBOL(of_get_machine_compatible);
>
--
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 |
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] of: add sanity check for machine compatible string
2024-05-29 9:33 [PATCH v1] of: add sanity check for machine compatible string Oleksij Rempel
2024-05-29 10:30 ` Ahmad Fatoum
@ 2024-05-30 13:27 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2024-05-30 13:27 UTC (permalink / raw)
To: barebox, Oleksij Rempel
On Wed, 29 May 2024 11:33:08 +0200, Oleksij Rempel wrote:
> Add a sanity check in of_get_machine_compatible to ensure we fall back
> to the default hostname "barebox" when the machine compatible string is
> empty. This prevents scenarios where no hostname is set, which can occur
> when starting an STM32 version of Barebox as a second stage on top of
> Barebox prior to commit 1da26bfb9da2 ("common: don't fixup empty serial/
> machine_compatible strings"). This fallback makes debugging easier in
> case someone faces a similar issue.
>
> [...]
Applied, thanks!
[1/1] of: add sanity check for machine compatible string
https://git.pengutronix.de/cgit/barebox/commit/?id=6edcb98c0dd5 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-30 13:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-29 9:33 [PATCH v1] of: add sanity check for machine compatible string Oleksij Rempel
2024-05-29 10:30 ` Ahmad Fatoum
2024-05-30 13:27 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox