diff options
-rw-r--r-- | drivers/base/core.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 7f59c2f2ebcb..7de543d1d0b4 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -621,7 +621,8 @@ static struct kobject *get_device_parent(struct device *dev, static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir) { /* see if we live in a "glue" directory */ - if (!dev->class || glue_dir->kset != &dev->class->class_dirs) + if (!glue_dir || !dev->class || + glue_dir->kset != &dev->class->class_dirs) return; kobject_put(glue_dir); @@ -773,7 +774,7 @@ int device_add(struct device *dev) dev = get_device(dev); if (!dev || !strlen(dev->bus_id)) { error = -EINVAL; - goto Error; + goto Done; } pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__); |