spi: fsi: add a missing of_node_put
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Tue, 20 Apr 2021 19:46:13 +0000 (21:46 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 21 Apr 2021 15:07:04 +0000 (16:07 +0100)
'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: bbb6b2f9865b ("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>
drivers/spi/spi-fsi.c

index de359718e816f6d8dc70cce4367d7256f8d3a116..87f8829c399521cb5c83d953fe44b9c2b1f3b816 100644 (file)
@@ -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;