aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-05-29 11:49:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-05-29 11:49:52 -0400
commitdeeb103412efcf9313e2d1dfe892fed4e372b9e7 (patch)
tree02beda159182e2fc8be3bdb2f73cca79e24fe168
parentc8bce3d3bdedc7d187fa222a3b36d149bd940d0e (diff)
parent5c8563d773c0e9f0ac2a552e84806decd98ce732 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: Driver Core: do not oops when driver_unregister() is called for unregistered drivers sysfs: file.c: use create_singlethread_workqueue()
-rw-r--r--drivers/base/bus.c4
-rw-r--r--drivers/base/core.c5
-rw-r--r--drivers/base/driver.c4
-rw-r--r--fs/sysfs/file.c2
4 files changed, 12 insertions, 3 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index dc030f1f00f1..c6599618523e 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -700,8 +700,10 @@ int bus_add_driver(struct device_driver *drv)
700 } 700 }
701 701
702 kobject_uevent(&priv->kobj, KOBJ_ADD); 702 kobject_uevent(&priv->kobj, KOBJ_ADD);
703 return error; 703 return 0;
704out_unregister: 704out_unregister:
705 kfree(drv->p);
706 drv->p = NULL;
705 kobject_put(&priv->kobj); 707 kobject_put(&priv->kobj);
706out_put_bus: 708out_put_bus:
707 bus_put(bus); 709 bus_put(bus);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 4aa527b8a913..1977d4beb89e 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -879,7 +879,7 @@ int device_add(struct device *dev)
879 } 879 }
880 880
881 if (!dev_name(dev)) 881 if (!dev_name(dev))
882 goto done; 882 goto name_error;
883 883
884 pr_debug("device: '%s': %s\n", dev_name(dev), __func__); 884 pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
885 885
@@ -978,6 +978,9 @@ done:
978 cleanup_device_parent(dev); 978 cleanup_device_parent(dev);
979 if (parent) 979 if (parent)
980 put_device(parent); 980 put_device(parent);
981name_error:
982 kfree(dev->p);
983 dev->p = NULL;
981 goto done; 984 goto done;
982} 985}
983 986
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index c51f11bb29ae..8ae0f63602e0 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -257,6 +257,10 @@ EXPORT_SYMBOL_GPL(driver_register);
257 */ 257 */
258void driver_unregister(struct device_driver *drv) 258void driver_unregister(struct device_driver *drv)
259{ 259{
260 if (!drv || !drv->p) {
261 WARN(1, "Unexpected driver unregister!\n");
262 return;
263 }
260 driver_remove_groups(drv, drv->groups); 264 driver_remove_groups(drv, drv->groups);
261 bus_remove_driver(drv); 265 bus_remove_driver(drv);
262} 266}
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index b1606e07b7a3..561a9c050cef 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -723,7 +723,7 @@ int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
723 mutex_unlock(&sysfs_workq_mutex); 723 mutex_unlock(&sysfs_workq_mutex);
724 724
725 if (sysfs_workqueue == NULL) { 725 if (sysfs_workqueue == NULL) {
726 sysfs_workqueue = create_workqueue("sysfsd"); 726 sysfs_workqueue = create_singlethread_workqueue("sysfsd");
727 if (sysfs_workqueue == NULL) { 727 if (sysfs_workqueue == NULL) {
728 module_put(owner); 728 module_put(owner);
729 return -ENOMEM; 729 return -ENOMEM;