summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-05-29 08:49:52 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-05-29 08:49:52 -0700
commitdeeb103412efcf9313e2d1dfe892fed4e372b9e7 (patch)
tree02beda159182e2fc8be3bdb2f73cca79e24fe168 /drivers
parentc8bce3d3bdedc7d187fa222a3b36d149bd940d0e (diff)
parent5c8563d773c0e9f0ac2a552e84806decd98ce732 (diff)
downloadop-kernel-dev-deeb103412efcf9313e2d1dfe892fed4e372b9e7.zip
op-kernel-dev-deeb103412efcf9313e2d1dfe892fed4e372b9e7.tar.gz
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()
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/bus.c4
-rw-r--r--drivers/base/core.c5
-rw-r--r--drivers/base/driver.c4
3 files changed, 11 insertions, 2 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index dc030f1..c659961 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -700,8 +700,10 @@ int bus_add_driver(struct device_driver *drv)
}
kobject_uevent(&priv->kobj, KOBJ_ADD);
- return error;
+ return 0;
out_unregister:
+ kfree(drv->p);
+ drv->p = NULL;
kobject_put(&priv->kobj);
out_put_bus:
bus_put(bus);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 4aa527b..1977d4b 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -879,7 +879,7 @@ int device_add(struct device *dev)
}
if (!dev_name(dev))
- goto done;
+ goto name_error;
pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
@@ -978,6 +978,9 @@ done:
cleanup_device_parent(dev);
if (parent)
put_device(parent);
+name_error:
+ kfree(dev->p);
+ dev->p = NULL;
goto done;
}
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index c51f11b..8ae0f63 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -257,6 +257,10 @@ EXPORT_SYMBOL_GPL(driver_register);
*/
void driver_unregister(struct device_driver *drv)
{
+ if (!drv || !drv->p) {
+ WARN(1, "Unexpected driver unregister!\n");
+ return;
+ }
driver_remove_groups(drv, drv->groups);
bus_remove_driver(drv);
}
OpenPOWER on IntegriCloud