summaryrefslogtreecommitdiff
path: root/drivers/core/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/core/device.c')
-rw-r--r--drivers/core/device.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c
index f0c23053eb..9506c7df8d 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -311,12 +311,11 @@ static void *alloc_priv(int size, uint flags)
return priv;
}
-int device_probe(struct udevice *dev)
+int device_ofdata_to_platdata(struct udevice *dev)
{
const struct driver *drv;
int size = 0;
int ret;
- int seq;
if (!dev)
return -EINVAL;
@@ -369,6 +368,32 @@ int device_probe(struct udevice *dev)
goto fail;
}
+ return 0;
+fail:
+ device_free(dev);
+
+ return ret;
+}
+
+int device_probe(struct udevice *dev)
+{
+ const struct driver *drv;
+ int ret;
+ int seq;
+
+ if (!dev)
+ return -EINVAL;
+
+ if (dev->flags & DM_FLAG_ACTIVATED)
+ return 0;
+
+ drv = dev->driver;
+ assert(drv);
+
+ ret = device_ofdata_to_platdata(dev);
+ if (ret)
+ goto fail;
+
/* Ensure all parents are probed */
if (dev->parent) {
ret = device_probe(dev->parent);