Unverified Commit be627abc authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Andi Shyti
Browse files

i2c: fsi: Fix a potential leak in fsi_i2c_probe()



In the commit in Fixes:, when the code has been updated to use an explicit
for loop, instead of for_each_available_child_of_node(), the assumption
that a reference to a device_node structure would be released at each
iteration has been broken.

Now, an explicit of_node_put() is needed to release the reference.

Fixes: 095561f4 ("i2c: fsi: Create busses for all ports")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: <stable@vger.kernel.org> # v5.3+
Signed-off-by: default avatarAndi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/fd805c39f8de51edf303856103d782138a1633c8.1772382022.git.christophe.jaillet@wanadoo.fr
parent aa79f996
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -729,6 +729,7 @@ static int fsi_i2c_probe(struct fsi_device *fsi_dev)
		rc = i2c_add_adapter(&port->adapter);
		if (rc < 0) {
			dev_err(dev, "Failed to register adapter: %d\n", rc);
			of_node_put(np);
			kfree(port);
			continue;
		}