lkml.org 
[lkml]   [2018]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    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);
    \
     
     \ /
      Last update: 2018-02-28 18:11    [W:2.307 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site