Skip to content

Commit be627ab

Browse files
tititiou36Andi Shyti
authored andcommitted
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: 095561f ("i2c: fsi: Create busses for all ports") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Cc: <stable@vger.kernel.org> # v5.3+ Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/fd805c39f8de51edf303856103d782138a1633c8.1772382022.git.christophe.jaillet@wanadoo.fr
1 parent aa79f99 commit be627ab

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/i2c/busses/i2c-fsi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,7 @@ static int fsi_i2c_probe(struct fsi_device *fsi_dev)
729729
rc = i2c_add_adapter(&port->adapter);
730730
if (rc < 0) {
731731
dev_err(dev, "Failed to register adapter: %d\n", rc);
732+
of_node_put(np);
732733
kfree(port);
733734
continue;
734735
}

0 commit comments

Comments
 (0)