Commit ec8164a6 authored by Tejun Heo's avatar Tejun Heo Committed by Greg Kroah-Hartman

[PATCH] driver-model: device_add() error path reference counting fix

 df_05_device_add_ref_fix.patch

 In device_add(), @dev wan't put'd properly when it has zero length
bus_id (error path).  Fixed.
Signed-off-by: default avatarTejun Heo <tj@home-tj.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 0a0250bb
...@@ -209,12 +209,12 @@ void device_initialize(struct device *dev) ...@@ -209,12 +209,12 @@ void device_initialize(struct device *dev)
*/ */
int device_add(struct device *dev) int device_add(struct device *dev)
{ {
struct device * parent; struct device *parent = NULL;
int error; int error = -EINVAL;
dev = get_device(dev); dev = get_device(dev);
if (!dev || !strlen(dev->bus_id)) if (!dev || !strlen(dev->bus_id))
return -EINVAL; goto Error;
parent = get_device(dev->parent); parent = get_device(dev->parent);
......
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