Skip to content

Commit

Permalink
spi: fsi: add a missing of_node_put
Browse files Browse the repository at this point in the history
'for_each_available_child_of_node' performs an of_node_get on each
iteration, so a return from the middle of the loop requires an of_node_put.

Fixes: bbb6b2f ("spi: Add FSI-attached SPI controller driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/504e431b900341249d331b868d90312cf41f415a.1618947919.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Christophe JAILLET authored and Mark Brown committed Apr 21, 2021
1 parent 31ed8eb commit 24b5515
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/spi/spi-fsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,10 @@ static int fsi_spi_probe(struct device *dev)
continue;

ctlr = spi_alloc_master(dev, sizeof(*ctx));
if (!ctlr)
if (!ctlr) {
of_node_put(np);
break;
}

ctlr->dev.of_node = np;
ctlr->num_chipselect = of_get_available_child_count(np) ?: 1;
Expand Down

0 comments on commit 24b5515

Please sign in to comment.