mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Subject: [PATCH v1] of: add sanity check for machine compatible string
Date: Wed, 29 May 2024 11:33:08 +0200	[thread overview]
Message-ID: <20240529093308.502072-1-o.rempel@pengutronix.de> (raw)

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




             reply	other threads:[~2024-05-29  9:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-29  9:33 Oleksij Rempel [this message]
2024-05-29 10:30 ` Ahmad Fatoum
2024-05-30 13:27 ` Sascha Hauer

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=20240529093308.502072-1-o.rempel@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --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