[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1409899047-13045-2-git-send-email-mcgrof@do-not-panic.com>
Date: Thu, 4 Sep 2014 23:37:22 -0700
From: "Luis R. Rodriguez" <mcgrof@...not-panic.com>
To: gregkh@...uxfoundation.org, dmitry.torokhov@...il.com,
falcon@...zu.com, tiwai@...e.de, tj@...nel.org,
arjan@...ux.intel.com
Cc: linux-kernel@...r.kernel.org, oleg@...hat.com, hare@...e.com,
akpm@...ux-foundation.org, penguin-kernel@...ove.sakura.ne.jp,
joseph.salisbury@...onical.com, bpoirier@...e.de,
santosh@...lsio.com, "Luis R. Rodriguez" <mcgrof@...e.com>
Subject: [RFC v2 1/6] driver-core: generalize freeing driver private member
From: "Luis R. Rodriguez" <mcgrof@...e.com>
This will be used later.
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.0.3
--
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