Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 497e1b3f authored by Amitoj Kaur Chawla's avatar Amitoj Kaur Chawla Committed by Dmitry Torokhov
Browse files

Input: cap11xx - add missing of_node_put



for_each_child_of_node performs an of_node_get on each iteration, so
to break out of the loop an of_node_put is required.

Found using Coccinelle.

Signed-off-by: default avatarAmitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent af6e9463
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -304,8 +304,10 @@ static int cap11xx_init_leds(struct device *dev,
		led->cdev.brightness = LED_OFF;

		error = of_property_read_u32(child, "reg", &reg);
		if (error != 0 || reg >= num_leds)
		if (error != 0 || reg >= num_leds) {
			of_node_put(child);
			return -EINVAL;
		}

		led->reg = reg;
		led->priv = priv;
@@ -313,8 +315,10 @@ static int cap11xx_init_leds(struct device *dev,
		INIT_WORK(&led->work, cap11xx_led_work);

		error = devm_led_classdev_register(dev, &led->cdev);
		if (error)
		if (error) {
			of_node_put(child);
			return error;
		}

		priv->num_leds++;
		led++;