FAILED: patch "[PATCH] power: supply: twl4030-charger: fix OF sibling-node lookup" failed to apply to 4.4-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
9844fb2e351311210e6660a9a1c62d17424a6145Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Mon, 27 Aug 2018 10:21:53 +0200
Subject: [PATCH] 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.
drivers/power/supply/twl4030_charger.c +3 -2
@@ -996,12 +996,13 @@ static int twl4030_bci_probe(struct platform_device *pdev)if (bci->dev->of_node) {struct device_node *phynode; - phynode =of_find_compatible_node (bci->dev->of_node->parent, -NULL ,"ti,twl4030-usb" ); + phynode =of_get_compatible_child (bci->dev->of_node->parent, +"ti,twl4030-usb" );if (phynode) { bci->usb_nb.notifier_call = twl4030_bci_usb_ncb; bci->transceiver =devm_usb_get_phy_by_node ( bci->dev, phynode, &bci->usb_nb); +of_node_put (phynode);if (IS_ERR (bci->transceiver)) { ret =PTR_ERR (bci->transceiver);if (ret == -EPROBE_DEFER )
Hi Greg,
Quoted 5 lines · Greg Kroah-Hartman
The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
The Subject says the patch failed to apply, but I'm guessing this one also caused build failure to a missing dependency. As I mentioned yesterday, and when submitting the fixes, these all depend on the new helper which was included in the same series:
36156f9241cb ("of: add helper to lookup compatible child node")
The original thread can be found here:
https://lkml.kernel.org/r/[email protected]
Again, sorry for not making this clear from the individual commit messages.
Johan
Quoted 48 lines
------------------ original commit in Linus's tree ------------------
From
9844fb2e351311210e6660a9a1c62d17424a6145Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Mon, 27 Aug 2018 10:21:53 +0200
Subject: [PATCH] power: supply: twl4030-charger: fix OF sibling-node lookupUse the new
of_get_compatible_child()helper to lookup the usb sibling node instead of usingof_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 f5e4edb8c888 ("power: twl4030_charger: find associated phy by more reliable means.")Cc stable <[email protected]> # 4.2Cc NeilBrown <[email protected]>Cc Felipe Balbi <[email protected]>Cc Sebastian Reichel <[email protected]>Reviewed-by Sebastian Reichel <[email protected]>Signed-off-by Johan Hovold <[email protected]>Signed-off-by Rob Herring <[email protected]>drivers/power/supply/twl4030_charger.c +3
-2@@ -996,12 +996,13 @@ static int twl4030_bci_probe(struct platform_device *pdev)if (bci->dev->of_node) {struct device_node *phynode; - phynode =of_find_compatible_node (bci->dev->of_node->parent, -NULL ,"ti,twl4030-usb" ); + phynode =of_get_compatible_child (bci->dev->of_node->parent, +"ti,twl4030-usb" );if (phynode) { bci->usb_nb.notifier_call = twl4030_bci_usb_ncb; bci->transceiver =devm_usb_get_phy_by_node ( bci->dev, phynode, &bci->usb_nb); +of_node_put (phynode);if (IS_ERR (bci->transceiver)) { ret =PTR_ERR (bci->transceiver);if (ret == -EPROBE_DEFER )