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.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 9c0070b5bd3e..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,
621static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir) 621static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir)
622{ 622{
623 /* see if we live in a "glue" directory */ 623 /* see if we live in a "glue" directory */
624 if (!dev->class || glue_dir->kset != &dev->class->class_dirs) 624 if (!glue_dir || !dev->class ||
625 glue_dir->kset != &dev->class->class_dirs)
625 return; 626 return;
626 627
627 kobject_put(glue_dir); 628 kobject_put(glue_dir);
@@ -770,17 +771,10 @@ int device_add(struct device *dev)
770 struct class_interface *class_intf; 771 struct class_interface *class_intf;
771 int error; 772 int error;
772 773
773 error = pm_sleep_lock();
774 if (error) {
775 dev_warn(dev, "Suspicious %s during suspend\n", __FUNCTION__);
776 dump_stack();
777 return error;
778 }
779
780 dev = get_device(dev); 774 dev = get_device(dev);
781 if (!dev || !strlen(dev->bus_id)) { 775 if (!dev || !strlen(dev->bus_id)) {
782 error = -EINVAL; 776 error = -EINVAL;
783 goto Error; 777 goto Done;
784 } 778 }
785 779
786 pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__); 780 pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__);
@@ -843,11 +837,9 @@ int device_add(struct device *dev)
843 } 837 }
844 Done: 838 Done:
845 put_device(dev); 839 put_device(dev);
846 pm_sleep_unlock();
847 return error; 840 return error;
848 BusError: 841 BusError:
849 device_pm_remove(dev); 842 device_pm_remove(dev);
850 dpm_sysfs_remove(dev);
851 PMError: 843 PMError:
852 if (dev->bus) 844 if (dev->bus)
853 blocking_notifier_call_chain(&dev->bus->p->bus_notifier, 845 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,