Commit 4a36b6a7 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Greg Kroah-Hartman

usb: host: ohci-exynos: Decrese node refcount on exynos_ehci_get_phy() error paths

commit 68bd6fc3 upstream.

Returning from for_each_available_child_of_node() loop requires cleaning
up node refcount.  Error paths lacked it so for example in case of
deferred probe, the refcount of phy node was left increased.

Fixes: 6d40500a ("usb: ehci/ohci-exynos: Fix of_node_put() for child when getting PHYs")
Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Reviewed-by: default avatarJavier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8f50cb88
...@@ -66,10 +66,12 @@ static int exynos_ohci_get_phy(struct device *dev, ...@@ -66,10 +66,12 @@ static int exynos_ohci_get_phy(struct device *dev,
if (IS_ERR(phy)) { if (IS_ERR(phy)) {
ret = PTR_ERR(phy); ret = PTR_ERR(phy);
if (ret == -EPROBE_DEFER) { if (ret == -EPROBE_DEFER) {
of_node_put(child);
return ret; return ret;
} else if (ret != -ENOSYS && ret != -ENODEV) { } else if (ret != -ENOSYS && ret != -ENODEV) {
dev_err(dev, dev_err(dev,
"Error retrieving usb2 phy: %d\n", ret); "Error retrieving usb2 phy: %d\n", ret);
of_node_put(child);
return ret; return ret;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment