Skip to content

Commit 2a4a4e8

Browse files
Wan Jiabingbroonie
authored andcommitted
spi: cadence: Add of_node_put() before return
Fix following coccicheck warning: ./drivers/spi/spi-cadence-xspi.c:490:1-23: WARNING: Function for_each_child_of_node should have of_node_put() before return Early exits from for_each_child_of_node should decrement the node reference counter. Signed-off-by: Wan Jiabing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent dbf641a commit 2a4a4e8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/spi/spi-cadence-xspi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,11 @@ static int cdns_xspi_of_get_plat_data(struct platform_device *pdev)
493493

494494
if (of_property_read_u32(node_child, "reg", &cs)) {
495495
dev_err(&pdev->dev, "Couldn't get memory chip select\n");
496+
of_node_put(node_child);
496497
return -ENXIO;
497498
} else if (cs >= CDNS_XSPI_MAX_BANKS) {
498499
dev_err(&pdev->dev, "reg (cs) parameter value too large\n");
500+
of_node_put(node_child);
499501
return -ENXIO;
500502
}
501503
}

0 commit comments

Comments
 (0)