From: "Luis R. Rodriguez" <mcg...@suse.com> This will be used later.
Signed-off-by: Luis R. Rodriguez <mcg...@suse.com> --- drivers/base/bus.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 83e910a..a5f41e4 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -657,6 +657,15 @@ static ssize_t uevent_store(struct device_driver *drv, const char *buf, } static DRIVER_ATTR_WO(uevent); +static void remove_driver_private(struct device_driver *drv) +{ + struct driver_private *priv = drv->p; + + kobject_put(&priv->kobj); + kfree(priv); + drv->p = NULL; +} + /** * bus_add_driver - Add a driver to the bus. * @drv: driver. @@ -719,9 +728,7 @@ int bus_add_driver(struct device_driver *drv) return 0; out_unregister: - kobject_put(&priv->kobj); - kfree(drv->p); - drv->p = NULL; + remove_driver_private(drv); out_put_bus: bus_put(bus); return error; -- 2.0.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/