提交 e0638fa4 编写于 作者: L Lixin Wang 提交者: Wolfram Sang

i2c: core: decrease reference count of device node in i2c_unregister_device

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: NLixin Wang <alan.1.wang@nokia-sbell.com>
Tested-by: NWolfram Sang <wsa@the-dreams.de>
Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
上级 a8750ddc
...@@ -821,8 +821,12 @@ void i2c_unregister_device(struct i2c_client *client) ...@@ -821,8 +821,12 @@ void i2c_unregister_device(struct i2c_client *client)
{ {
if (!client) if (!client)
return; return;
if (client->dev.of_node)
if (client->dev.of_node) {
of_node_clear_flag(client->dev.of_node, OF_POPULATED); of_node_clear_flag(client->dev.of_node, OF_POPULATED);
of_node_put(client->dev.of_node);
}
if (ACPI_COMPANION(&client->dev)) if (ACPI_COMPANION(&client->dev))
acpi_device_clear_enumerated(ACPI_COMPANION(&client->dev)); acpi_device_clear_enumerated(ACPI_COMPANION(&client->dev));
device_unregister(&client->dev); device_unregister(&client->dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册