linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: spi-xilinx: fix for_each_child.cocci warnings
@ 2022-02-08 20:51 Julia Lawall
  2022-02-09 10:33 ` Ricardo Ribalda Delgado
  2022-02-09 13:25 ` Mark Brown
  0 siblings, 2 replies; 7+ messages in thread
From: Julia Lawall @ 2022-02-08 20:51 UTC (permalink / raw)
  To: Amit Kumar Mahapatra, Michal Simek, Sai Krishna Potthuri,
	Tejas Prajapati Rameshchandra, Naga Sureshkumar Relli,
	Shubhrajyoti Datta, Ricardo Ribalda Delgado, Mark Brown
  Cc: linux-spi, linux-arm-kernel, linux-kernel, kbuild-all, linux-arm-kernel

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

After for_each_available_child_of_node, of_node_put is needed before break
and return.

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

Fixes: 3973536c4560 ("spi: spi-xilinx: Updated axi-qspi controller driver")
CC: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15
head:   1183ce490adb103e5e569b8ebd74c50c885ddc05
commit: 3973536c456079bf3d09e9a97bf33d29422b183f [861/872] spi: spi-xilinx: Updated axi-qspi controller driver
:::::: branch date: 7 days ago
:::::: commit date: 7 days ago

 spi-xilinx.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -693,13 +693,16 @@ static int xilinx_spi_probe(struct platf
 		if (startup_block) {
 			ret = of_property_read_u32(nc, "reg",
 						   &cs_num);
-			if (ret < 0)
+			if (ret < 0) {
+				of_node_put(nc);
 				return -EINVAL;
+			}
 		}
 		ret = of_property_read_u32(nc, "spi-rx-bus-width",
 					   &rx_bus_width);
 		if (!ret) {
 			xspi->rx_bus_width = rx_bus_width;
+			of_node_put(nc);
 			break;
 		}
 	}

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH] spi: spi-xilinx: fix for_each_child.cocci warnings
@ 2022-06-26 14:18 Julia Lawall
  2022-06-27 12:23 ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2022-06-26 14:18 UTC (permalink / raw)
  To: Amit Kumar Mahapatra
  Cc: kbuild-all, lkp, linux-arm-kernel, Michal Simek,
	Sai Krishna Potthuri, Tejas Prajapati Rameshchandra,
	Naga Sureshkumar Relli, Shubhrajyoti Datta,
	Ricardo Ribalda Delgado, Mark Brown, linux-spi, linux-arm-kernel,
	linux-kernel

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

for_each_available_child_of_node should have of_node_put() before return around line 697.
for_each_available_child_of_node should have of_node_put() before break around line 703.

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

Fixes: 3973536c4560 ("spi: spi-xilinx: Updated axi-qspi controller driver")
CC: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15_LTS
head:   59523b5c4aca0174f1f8cba2a07d3b3328b7c80e
commit: 3973536c456079bf3d09e9a97bf33d29422b183f [861/1181] spi: spi-xilinx: Updated axi-qspi controller driver
:::::: branch date: 5 days ago
:::::: commit date: 5 months ago

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

 drivers/spi/spi-xilinx.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -693,13 +693,16 @@ static int xilinx_spi_probe(struct platf
 		if (startup_block) {
 			ret = of_property_read_u32(nc, "reg",
 						   &cs_num);
-			if (ret < 0)
+			if (ret < 0) {
+				of_node_put(nc);
 				return -EINVAL;
+			}
 		}
 		ret = of_property_read_u32(nc, "spi-rx-bus-width",
 					   &rx_bus_width);
 		if (!ret) {
 			xspi->rx_bus_width = rx_bus_width;
+			of_node_put(nc);
 			break;
 		}
 	}

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-06-27 12:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-08 20:51 [PATCH] spi: spi-xilinx: fix for_each_child.cocci warnings Julia Lawall
2022-02-09 10:33 ` Ricardo Ribalda Delgado
2022-02-09 13:12   ` Mark Brown
2022-02-09 13:52     ` Ricardo Ribalda Delgado
2022-02-09 13:25 ` Mark Brown
2022-06-26 14:18 Julia Lawall
2022-06-27 12:23 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).