[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1519831218.548185190@decadent.org.uk>
Date: Wed, 28 Feb 2018 15:20:18 +0000
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org, "Wolfram Sang" <wsa@...-dreams.de>,
"Lixin Wang" <alan.1.wang@...ia-sbell.com>
Subject: [PATCH 3.16 216/254] i2c: core: decrease reference count of
device node in i2c_unregister_device
3.16.55-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lixin Wang <alan.1.wang@...ia-sbell.com>
commit e0638fa400eaccf9fa8060f67140264c4e276552 upstream.
Reference count of device node was increased in of_i2c_register_device,
but without decreasing it in i2c_unregister_device. Then the added
device node will never be released. Fix this by adding the of_node_put.
Signed-off-by: Lixin Wang <alan.1.wang@...ia-sbell.com>
Tested-by: Wolfram Sang <wsa@...-dreams.de>
Signed-off-by: Wolfram Sang <wsa@...-dreams.de>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
drivers/i2c/i2c-core.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -740,6 +740,10 @@ EXPORT_SYMBOL_GPL(i2c_new_device);
*/
void i2c_unregister_device(struct i2c_client *client)
{
+ if (client->dev.of_node) {
+ of_node_put(client->dev.of_node);
+ }
+
device_unregister(&client->dev);
}
EXPORT_SYMBOL_GPL(i2c_unregister_device);
Powered by blists - more mailing lists