Commit 6c17a9a8 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Lee Jones
Browse files

leds: 88pm860x: 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: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240816-cleanup-h-of-node-put-var-v1-5-1d0292802470@linaro.org


Signed-off-by: default avatarLee Jones <lee@kernel.org>
parent 05c2f554
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ static int pm860x_led_set(struct led_classdev *cdev,
static int pm860x_led_dt_init(struct platform_device *pdev,
			      struct pm860x_led *data)
{
	struct device_node *nproot, *np;
	struct device_node *nproot;
	int iset = 0;

	if (!dev_of_node(pdev->dev.parent))
@@ -125,12 +125,11 @@ static int pm860x_led_dt_init(struct platform_device *pdev,
		dev_err(&pdev->dev, "failed to find leds node\n");
		return -ENODEV;
	}
	for_each_available_child_of_node(nproot, np) {
	for_each_available_child_of_node_scoped(nproot, np) {
		if (of_node_name_eq(np, data->name)) {
			of_property_read_u32(np, "marvell,88pm860x-iset",
					     &iset);
			data->iset = PM8606_LED_CURRENT(iset);
			of_node_put(np);
			break;
		}
	}