[PATCH v1] of: add sanity check for machine compatible string

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

 



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





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

  Powered by Linux