Commit f35ce67f authored by Patrick Mochel's avatar Patrick Mochel

driver model: keep reference to device during device_add().

parent 95ca3c33
...@@ -169,6 +169,7 @@ int device_add(struct device *dev) ...@@ -169,6 +169,7 @@ int device_add(struct device *dev)
struct device * parent; struct device * parent;
int error; int error;
dev = get_device(dev);
if (!dev || !strlen(dev->bus_id)) if (!dev || !strlen(dev->bus_id))
return -EINVAL; return -EINVAL;
...@@ -208,6 +209,7 @@ int device_add(struct device *dev) ...@@ -208,6 +209,7 @@ int device_add(struct device *dev)
register_done: register_done:
if (error && parent) if (error && parent)
put_device(parent); put_device(parent);
put_device(dev);
return error; 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