[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1411768637-6809-5-git-send-email-mcgrof@do-not-panic.com>
Date: Fri, 26 Sep 2014 14:57:16 -0700
From: "Luis R. Rodriguez" <mcgrof@...not-panic.com>
To: gregkh@...uxfoundation.org, dmitry.torokhov@...il.com,
tiwai@...e.de, tj@...nel.org, arjan@...ux.intel.com
Cc: teg@...m.no, rmilasan@...e.com, werner@...e.com, oleg@...hat.com,
hare@...e.com, bpoirier@...e.de, santosh@...lsio.com,
pmladek@...e.cz, dbueso@...e.com, mcgrof@...e.com,
linux-kernel@...r.kernel.org
Subject: [PATCH v1 4/5] driver-core: generalize freeing driver private member
From: "Luis R. Rodriguez" <mcgrof@...e.com>
This will be used later.
Cc: Tejun Heo <tj@...nel.org>
Cc: Arjan van de Ven <arjan@...ux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Luis R. Rodriguez <mcgrof@...e.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.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists