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: ohci-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/20240821071752.2335406-1-ruanjinjie@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

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

+2 -7
+2 -7
drivers/usb/host/ohci-exynos.c
··· 37 37 static int exynos_ohci_get_phy(struct device *dev, 38 38 struct exynos_ohci_hcd *exynos_ohci) 39 39 { 40 - struct device_node *child; 41 40 struct phy *phy; 42 41 int phy_number, num_phys; 43 42 int ret; ··· 54 55 return 0; 55 56 56 57 /* Get PHYs using legacy bindings */ 57 - for_each_available_child_of_node(dev->of_node, child) { 58 + for_each_available_child_of_node_scoped(dev->of_node, child) { 58 59 ret = of_property_read_u32(child, "reg", &phy_number); 59 60 if (ret) { 60 61 dev_err(dev, "Failed to parse device tree\n"); 61 - of_node_put(child); 62 62 return ret; 63 63 } 64 64 65 65 if (phy_number >= PHY_NUMBER) { 66 66 dev_err(dev, "Invalid number of PHYs\n"); 67 - of_node_put(child); 68 67 return -EINVAL; 69 68 } 70 69 71 70 phy = devm_of_phy_optional_get(dev, child, NULL); 72 71 exynos_ohci->phy[phy_number] = phy; 73 - if (IS_ERR(phy)) { 74 - of_node_put(child); 72 + if (IS_ERR(phy)) 75 73 return PTR_ERR(phy); 76 - } 77 74 } 78 75 79 76 exynos_ohci->legacy_phy = true;