]> git.baikalelectronics.ru Git - kernel.git/commit
power: supply: twl4030-charger: fix OF sibling-node lookup
authorJohan Hovold <johan@kernel.org>
Mon, 27 Aug 2018 08:21:53 +0000 (10:21 +0200)
committerRob Herring <robh@kernel.org>
Tue, 23 Oct 2018 18:28:53 +0000 (13:28 -0500)
commit9e31cf7a873f8e26a04f5d38c1d03917c20855d0
tree802a7f3c566481a4e46a32b4adecbec2a7b1805f
parent74dd78655dc49cbe2328afb3464df7efd3487257
power: supply: twl4030-charger: fix OF sibling-node lookup

Use the new of_get_compatible_child() helper to lookup the usb sibling
node instead of using of_find_compatible_node(), which searches the
entire tree from a given start node and thus can return an unrelated
(non-sibling) node.

This also addresses a potential use-after-free (e.g. after probe
deferral) as the tree-wide helper drops a reference to its first
argument (i.e. the parent device node).

While at it, also fix the related phy-node reference leak.

Fixes: 1c0c332d1f90 ("power: twl4030_charger: find associated phy by more reliable means.")
Cc: stable <stable@vger.kernel.org> # 4.2
Cc: NeilBrown <neilb@suse.de>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Sebastian Reichel <sre@kernel.org>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
drivers/power/supply/twl4030_charger.c