[PATCH] spi: fix for_each_child.cocci warnings

kernel test robot lkp at intel.com
Fri Dec 17 14:46:05 PST 2021


From: kernel test robot <lkp at intel.com>

drivers/spi/spi-zynqmp-gqspi.c:1360:1-33: WARNING: Function "for_each_available_child_of_node" should have of_node_put() before break around line 1365.
drivers/spi/spi-zynqmp-gqspi.c:1372:1-33: WARNING: Function "for_each_available_child_of_node" should have of_node_put() before break around line 1377.


Semantic patch information:
 False positives can be due to function calls within the for_each
 loop that may encapsulate an of_node_put.

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

Fixes: 5d37ab2cf69a ("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>
---

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.10
head:   87ec9a2d98a7a7dfc98b57348a0ec310fd170e4b
commit: 5d37ab2cf69a5d4367f49fca798d78e4be66a43b [724/1981] spi: Update ZynqMP and Versal QSPI controller driver
:::::: branch date: 4 days ago
:::::: commit date: 7 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