Messages in this thread Patch in this message | | | From | Ben Hutchings <> | Date | Wed, 28 Feb 2018 15:20:18 +0000 | 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@nokia-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@nokia-sbell.com> Tested-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings <ben@decadent.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);
| |