[PATCH] i2c: core: decrease reference count of device node in i2c_unregister_device

2017-11-26 Thread Lixin Wang
Reference count of device node was increased in of_i2c_register_device, but without decreasing it in i2c_unregister_device. Then the dynamically added device node will never be released. Fix this by adding the of_node_put. Signed-off-by: Lixin Wang --- drivers/i2c/i2c-core-base.c | 4 +++- 1

[PATCH v5] of: dynamic: fix memory leak related to properties of __of_node_dup

2017-10-22 Thread Lixin Wang
off-by: Lixin Wang --- v4 -> v5: * fix the bug in v4, that the prop->next should be saved before release the prop. drivers/of/dynamic.c | 26 ++ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index 301b

[PATCH v4] of: dynamic: fix memory leak related to properties of __of_node_dup

2017-10-19 Thread Lixin Wang
off-by: Lixin Wang Reviewed-by: Frank Rowand --- Thanks the idea from Rob Herring, that I forgot to mention at patch v3. Thanks Frank Rowand for writing to me the example. v3 -> v4: * Using the style that is more consistent with device tree code, as suggested by Frank Rowand drivers/of/

[PATCH v3] of: dynamic: fix memory leak related to properties of __of_node_dup

2017-10-19 Thread Lixin Wang
off-by: Lixin Wang --- v2 -> v3: * Add a separate function to release the properties in both lists. * Change the patch description for this change. drivers/of/dynamic.c | 27 +++ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/of/dynamic.c b/d

[PATCH v2] of: dynamic: fix memory leak related to properties of __of_node_dup

2017-10-16 Thread Lixin Wang
If a node with no properties is dynamically added, then a property is dynamically added to the node, then the property is dynamically removed, the result will be node->properties == NULL and node->deadprops != NULL. Signed-off-by: Lixin Wang --- v1: * Change the description of this pa

[PATCH] of: overlay: fix memory leak related to duplicated property

2017-10-16 Thread Lixin Wang
From: alawang Function of_changeset_add_property or of_changeset_update_property may fails. In this case the property just allocated is never deallocated. Signed-off-by: Lixin Wang --- drivers/of/overlay.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a

[PATCH] of: dynamic: fix memory leak related to properties of __of_node_dup

2017-10-12 Thread Lixin Wang
, all properties of which had been moved to deadprops. In this case, the properties in the deadprops list are never deallocated. Signed-off-by: Lixin Wang --- drivers/of/dynamic.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index 301b6db

[PATCH] of: overlay: fix memory leak related to duplicated property

2017-10-12 Thread Lixin Wang
: Lixin Wang --- drivers/of/overlay.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index 8ecfee3..af3b9a1 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -162,6 +162,7 @@ static int