Commit b0f48f7f authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Driver Core: add warnings if .release functions are not set for objects.

This has been in the -mm tree for a while and has helped a lot in finding
lots of improper users of the driver core.  It also moves the driver core
code up quite a few levels on the "Rusty's guide to kernel APIs".
parent 3d61cad0
......@@ -194,6 +194,12 @@ static void class_dev_release(struct kobject * kobj)
if (cls->release)
cls->release(cd);
else {
printk(KERN_ERR "Device class '%s' does not have a release() function, "
"it is broken and must be fixed.\n",
cd->class_id);
WARN_ON(1);
}
}
static struct kobj_type ktype_class_device = {
......
......@@ -77,6 +77,12 @@ static void device_release(struct kobject * kobj)
struct device * dev = to_dev(kobj);
if (dev->release)
dev->release(dev);
else {
printk(KERN_ERR "Device '%s' does not have a release() function, "
"it is broken and must be fixed.\n",
dev->bus_id);
WARN_ON(1);
}
}
static struct kobj_type ktype_device = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment