Commit 5f330849 authored by Patrick Mochel's avatar Patrick Mochel

driver model: make sure device has driver when we add it to the class.

There is a chance devclass_add_device() could get passed a device with no driver, so
we need to check that.
parent 0447d4d5
......@@ -53,8 +53,11 @@ static void unenum_device(struct device_class * cls, struct device * dev)
int devclass_add_device(struct device * dev)
{
struct device_class * cls = dev->driver->devclass;
struct device_class * cls;
int error = 0;
if (dev->driver) {
cls = dev->driver->devclass;
if (cls) {
pr_debug("adding device '%s' to class '%s'\n",
dev->name,cls->name);
......@@ -65,6 +68,7 @@ int devclass_add_device(struct device * dev)
interface_add(cls,dev);
}
}
}
return error;
}
......
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