[PATCH] spi: fix for_each_child.cocci warnings

Julia Lawall julia.lawall at inria.fr
Thu Sep 2 09:54:21 PDT 2021


for_each_available_child_of_node should have of_node_put() before
escaping the loop via the breaks..

Generated by: scripts/coccinelle/iterators/for_each_child.cocci

Fixes: ffc5cb8494ba ("spi: Update ZynqMP and Versal QSPI controller driver")
CC: Amit Kumar Mahapatra <amit.kumar-mahapatra at xilinx.com>
Reported-by: kernel test robot <lkp at intel.com>
Signed-off-by: kernel test robot <lkp at intel.com>
Signed-off-by: Julia Lawall <julia.lawall at inria.fr>
---

tree:   https://github.com/Xilinx/linux-xlnx master
head:   52495976d054651fbf88cb12e08c57bf8d0ad781
commit: ffc5cb8494ba2abe218134584b22fd874b71d504 [11243/12425] spi: Update ZynqMP and Versal QSPI controller driver
:::::: branch date: 2 days ago
:::::: commit date: 5 months ago

Please take the patch only if it's a positive warning. Thanks!

 spi-zynqmp-gqspi.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/spi/spi-zynqmp-gqspi.c
+++ b/drivers/spi/spi-zynqmp-gqspi.c
@@ -1362,6 +1362,7 @@ static int zynqmp_qspi_probe(struct plat
 					   &rx_bus_width);
 		if (!ret) {
 			xqspi->rx_bus_width = rx_bus_width;
+			of_node_put(nc);
 			break;
 		}
 	}
@@ -1374,6 +1375,7 @@ static int zynqmp_qspi_probe(struct plat
 					   &tx_bus_width);
 		if (!ret) {
 			xqspi->tx_bus_width = tx_bus_width;
+			of_node_put(nc);
 			break;
 		}
 	}



More information about the linux-arm-kernel mailing list