Skip to content

Commit 9b21671

Browse files
Jinjie Ruanlag-linaro
authored andcommitted
backlight: 88pm860x_bl: Simplify with scoped for each OF child loop
Use scoped for_each_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: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240822062546.3490076-1-ruanjinjie@huawei.com Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 0d580d9 commit 9b21671

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/video/backlight/88pm860x_bl.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,22 +151,21 @@ static int pm860x_backlight_dt_init(struct platform_device *pdev,
151151
struct pm860x_backlight_data *data,
152152
char *name)
153153
{
154-
struct device_node *nproot, *np;
154+
struct device_node *nproot;
155155
int iset = 0;
156156

157157
nproot = of_get_child_by_name(pdev->dev.parent->of_node, "backlights");
158158
if (!nproot) {
159159
dev_err(&pdev->dev, "failed to find backlights node\n");
160160
return -ENODEV;
161161
}
162-
for_each_child_of_node(nproot, np) {
162+
for_each_child_of_node_scoped(nproot, np) {
163163
if (of_node_name_eq(np, name)) {
164164
of_property_read_u32(np, "marvell,88pm860x-iset",
165165
&iset);
166166
data->iset = PM8606_WLED_CURRENT(iset);
167167
of_property_read_u32(np, "marvell,88pm860x-pwm",
168168
&data->pwm);
169-
of_node_put(np);
170169
break;
171170
}
172171
}

0 commit comments

Comments
 (0)