Skip to contentSkip to conversation

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

PATCH In review Krzysztof Kozlowski 3 participants 6 messages Jan 7, 2017 – Jan 9, 2017

Subsystems (4)
lore
Share & tools
lore

Krzysztof Kozlowski

author maintainer
#0 lore raw

PATCH 1/2 usb: host: ehci-exynos: Decrese node refcount on exynos_ehci_get_phy() error paths

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 6d40500ac9b6 ("usb: ehci/ohci-exynos: Fix of_node_put() for child when getting PHYs")
---
 drivers/usb/host/ehci-exynos.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/host/ehci-exynos.c +2 -0
index 42e5b66353ef..7a603f66a9bc 100644
@@ -77,10 +77,12 @@ static int exynos_ehci_get_phy(struct device *dev,
 		if (IS_ERR(phy)) {
 			ret = PTR_ERR(phy);
 			if (ret == -EPROBE_DEFER) {
+				of_node_put(child);
 				return ret;
 			} else if (ret != -ENOSYS && ret != -ENODEV) {
 				dev_err(dev,
 					"Error retrieving usb2 phy: %d\n", ret);
+				of_node_put(child);
 				return ret;
 			}
 		}
Signature · 1 line
2.9.3
author maintainer
#1 lore raw

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

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 6d40500ac9b6 ("usb: ehci/ohci-exynos: Fix of_node_put() for child when getting PHYs")
---
 drivers/usb/host/ohci-exynos.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/host/ohci-exynos.c +2 -0
index 2cd105be7319..6865b919403f 100644
@@ -66,10 +66,12 @@ static int exynos_ohci_get_phy(struct device *dev,
 		if (IS_ERR(phy)) {
 			ret = PTR_ERR(phy);
 			if (ret == -EPROBE_DEFER) {
+				of_node_put(child);
 				return ret;
 			} else if (ret != -ENOSYS && ret != -ENODEV) {
 				dev_err(dev,
 					"Error retrieving usb2 phy: %d\n", ret);
+				of_node_put(child);
 				return ret;
 			}
 		}
Signature · 1 line
2.9.3
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] usb: host: ohci-exynos: Decrese node refcount on exynos_ehci_get_phy() error paths

Hello Krzysztof,

Quoted 7 lines · Krzysztof Kozlowski

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 6d40500ac9b6 ("usb: ehci/ohci-exynos: Fix of_node_put() for child when getting PHYs")

---

Best regards,

Signature · 3 lines
Javier Martinez Canillas
Open Source Group
Samsung Research America
maintainer Acked-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] usb: host: ohci-exynos: Decrese node refcount on exynos_ehci_get_phy() error paths

In reply to Krzysztof Kozlowski
Quoted 17 lines · Krzysztof Kozlowski

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 6d40500ac9b6 ("usb: ehci/ohci-exynos: Fix of_node_put() for child when getting PHYs")
---
 drivers/usb/host/ohci-exynos.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/host/ohci-exynos.c +0 -0
index 2cd105be7319..6865b919403f 100644
@@ -66,10 +66,12 @@ static int exynos_ohci_get_phy(struct device *dev,
 		if (IS_ERR(phy)) {
 			ret = PTR_ERR(phy);

drivers/usb/host/ohci-exynos.c static int exynos_ohci_get_phy(struct device *dev, · line 77

Quoted 10 lines
drivers/usb/host/ohci-exynos.c +2 -0
 			if (ret == -EPROBE_DEFER) {
+				of_node_put(child);
 				return ret;
 			} else if (ret != -ENOSYS && ret != -ENODEV) {
 				dev_err(dev,
 					"Error retrieving usb2 phy: %d\n", ret);
+				of_node_put(child);
 				return ret;
 			}
 		}
Reviewed-by on v1 1/2
#4 lore raw
In reply to Krzysztof Kozlowski

Hello Krzysztof,

Quoted 7 lines · Krzysztof Kozlowski

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 6d40500ac9b6 ("usb: ehci/ohci-exynos: Fix of_node_put() for child when getting PHYs")

---

Best regards,

Signature · 3 lines
Javier Martinez Canillas
Open Source Group
Samsung Research America
maintainer Acked-by on v1 1/2
#5 lore raw
In reply to Krzysztof Kozlowski
Quoted 18 lines · Krzysztof Kozlowski

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 6d40500ac9b6 ("usb: ehci/ohci-exynos: Fix of_node_put() for child when getting PHYs")
---
 drivers/usb/host/ehci-exynos.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/host/ehci-exynos.c +0 -0
index 42e5b66353ef..7a603f66a9bc 100644
@@ -77,10 +77,12 @@ static int exynos_ehci_get_phy(struct device *dev,
 		if (IS_ERR(phy)) {
 			ret = PTR_ERR(phy);

drivers/usb/host/ehci-exynos.c static int exynos_ehci_get_phy(struct device *dev, · line 88

Quoted 10 lines
drivers/usb/host/ehci-exynos.c +2 -0
 			if (ret == -EPROBE_DEFER) {
+				of_node_put(child);
 				return ret;
 			} else if (ret != -ENOSYS && ret != -ENODEV) {
 				dev_err(dev,
 					"Error retrieving usb2 phy: %d\n", ret);
+				of_node_put(child);
 				return ret;
 			}
 		}