aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r--drivers/base/core.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 0db47561331e..e21a65fc043e 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -378,6 +378,13 @@ int device_add(struct device *dev)
378 if (!dev || !strlen(dev->bus_id)) 378 if (!dev || !strlen(dev->bus_id))
379 goto Error; 379 goto Error;
380 380
381 /* if this is a class device, and has no parent, create one */
382 if ((dev->class) && (dev->parent == NULL)) {
383 error = virtual_device_parent(dev);
384 if (error)
385 goto Error;
386 }
387
381 parent = get_device(dev->parent); 388 parent = get_device(dev->parent);
382 389
383 pr_debug("DEV: registering device: ID = '%s'\n", dev->bus_id); 390 pr_debug("DEV: registering device: ID = '%s'\n", dev->bus_id);