@@ -706,7 +706,6 @@ static int knav_dma_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *node = pdev->dev.of_node;
- struct device_node *child;
int ret = 0;
if (!node) {
@@ -732,10 +731,9 @@ static int knav_dma_probe(struct platform_device *pdev)
}
/* Initialise all packet dmas */
- for_each_child_of_node(node, child) {
+ for_each_child_of_node_scoped(node, child) {
ret = dma_init(node, child);
if (ret) {
- of_node_put(child);
dev_err(&pdev->dev, "init failed with %d\n", ret);
break;
}
Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> --- v2: - Split into 2 patches. --- drivers/soc/ti/knav_dma.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)