diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2022-07-25 09:43:00 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-08-08 15:43:36 +0200 |
commit | 583855354bfc13367aca013159cdb5b5addc3ca2 (patch) | |
tree | ec9b2359d37eaf07b872c2f0cf619f740ae0ba71 | |
parent | 6e0bd0767a775291870daea743f82b94f7d909ac (diff) | |
download | barebox-583855354bfc13367aca013159cdb5b5addc3ca2.tar.gz barebox-583855354bfc13367aca013159cdb5b5addc3ca2.tar.xz |
driver: disassociate dev from device_node on unregister_device
Reusing the same device node with of_platform_device_create
after unregistering an old device doesn't work, because the device_node
-> device_d association added along with deep probe isn't cleared.
Resolve this.
Fixes: 46afd4bf8fa6 ("of: platform: Keep track of populated platform devices")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220725074259.2651494-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/base/driver.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 303ca061ce..2008f6caf2 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c @@ -265,6 +265,8 @@ int unregister_device(struct device_d *old_dev) /* remove device from parents child list */ if (old_dev->parent) list_del(&old_dev->sibling); + if (dev_of_node(old_dev)) + old_dev->device_node->dev = NULL; return 0; } |