From 153851ddfa39dc1bd4f3b5402d80487d52c644aa Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 29 Dec 2019 21:19:21 -0700 Subject: dm: core: Add a new flag to track platform data We want to avoid allocating platform data twice. This could happen if device_probe() is called after device_ofdata_to_platdata() for the same device. Add a flag to track whether device_ofdata_to_platdata() has been called on a device. Check the flag to make sure it doesn't happen twice, and clear the flag when the data is freed. Signed-off-by: Simon Glass --- drivers/core/device-remove.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/core/device-remove.c') diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c index 5c8dc4ad70..444e34b492 100644 --- a/drivers/core/device-remove.c +++ b/drivers/core/device-remove.c @@ -140,6 +140,7 @@ void device_free(struct udevice *dev) dev->parent_priv = NULL; } } + dev->flags &= ~DM_FLAG_PLATDATA_VALID; devres_release_probe(dev); } -- cgit