diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-11-25 17:06:36 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-11-30 11:33:06 +0100 |
commit | 78caf413a987adfa7fcd0f7afc7bdb7cb5fce8b8 (patch) | |
tree | e2350d5bb46a8fa9c226f03a3825db13d08bd90a | |
parent | bf850479f92cb3ffd566158c851c2ecf67bd1bcd (diff) | |
download | barebox-78caf413a987adfa7fcd0f7afc7bdb7cb5fce8b8.tar.gz barebox-78caf413a987adfa7fcd0f7afc7bdb7cb5fce8b8.tar.xz |
of: skip machine device creation on subsequent of_probe
of_probe may be called more than once, e.g. after oftree -p or by board
code after fixing up device tree. This currently leads to a harmless,
but annoying error message about machine already being registered.
Avoid this by creating the device only once.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211125160637.3828394-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/of/base.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index 910348fb81..ec4f932703 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2333,9 +2333,12 @@ mem_initcall(of_probe_memory); static void of_platform_device_create_root(struct device_node *np) { - struct device_d *dev; + static struct device_d *dev; int ret; + if (dev) + return; + dev = xzalloc(sizeof(*dev)); dev->id = DEVICE_ID_SINGLE; dev->device_node = np; |