Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: ehci-exynos: Simplify with scoped for each OF child loop

Use scoped for_each_available_child_of_node_scoped() when iterating over
device nodes to make code a bit simpler.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Reviewed-by: Anand Moon <linux.amoon@gmail.com>
Link: https://lore.kernel.org/r/20240821071856.2335529-1-ruanjinjie@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jinjie Ruan and committed by
Greg Kroah-Hartman
3cc92765 b5a71dce

+2 -7
+2 -7
drivers/usb/host/ehci-exynos.c
··· 48 48 static int exynos_ehci_get_phy(struct device *dev, 49 49 struct exynos_ehci_hcd *exynos_ehci) 50 50 { 51 - struct device_node *child; 52 51 struct phy *phy; 53 52 int phy_number, num_phys; 54 53 int ret; ··· 65 66 return 0; 66 67 67 68 /* Get PHYs using legacy bindings */ 68 - for_each_available_child_of_node(dev->of_node, child) { 69 + for_each_available_child_of_node_scoped(dev->of_node, child) { 69 70 ret = of_property_read_u32(child, "reg", &phy_number); 70 71 if (ret) { 71 72 dev_err(dev, "Failed to parse device tree\n"); 72 - of_node_put(child); 73 73 return ret; 74 74 } 75 75 76 76 if (phy_number >= PHY_NUMBER) { 77 77 dev_err(dev, "Invalid number of PHYs\n"); 78 - of_node_put(child); 79 78 return -EINVAL; 80 79 } 81 80 82 81 phy = devm_of_phy_optional_get(dev, child, NULL); 83 82 exynos_ehci->phy[phy_number] = phy; 84 - if (IS_ERR(phy)) { 85 - of_node_put(child); 83 + if (IS_ERR(phy)) 86 84 return PTR_ERR(phy); 87 - } 88 85 } 89 86 90 87 exynos_ehci->legacy_phy = true;