Skip to content

Commit e1b391e

Browse files
Wan Jiabingandersson
authored andcommitted
soc: qcom: smp2p: Add of_node_put() before goto
Fix following coccicheck warning: ./drivers/soc/qcom/smp2p.c:501:1-33: WARNING: Function for_each_available_child_of_node should have of_node_put() before goto Early exits from for_each_available_child_of_node should decrement the node reference counter. Signed-off-by: Wan Jiabing <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 72f1aa6 commit e1b391e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/soc/qcom/smp2p.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,26 +573,33 @@ static int qcom_smp2p_probe(struct platform_device *pdev)
573573
entry = devm_kzalloc(&pdev->dev, sizeof(*entry), GFP_KERNEL);
574574
if (!entry) {
575575
ret = -ENOMEM;
576+
of_node_put(node);
576577
goto unwind_interfaces;
577578
}
578579

579580
entry->smp2p = smp2p;
580581
spin_lock_init(&entry->lock);
581582

582583
ret = of_property_read_string(node, "qcom,entry-name", &entry->name);
583-
if (ret < 0)
584+
if (ret < 0) {
585+
of_node_put(node);
584586
goto unwind_interfaces;
587+
}
585588

586589
if (of_property_read_bool(node, "interrupt-controller")) {
587590
ret = qcom_smp2p_inbound_entry(smp2p, entry, node);
588-
if (ret < 0)
591+
if (ret < 0) {
592+
of_node_put(node);
589593
goto unwind_interfaces;
594+
}
590595

591596
list_add(&entry->node, &smp2p->inbound);
592597
} else {
593598
ret = qcom_smp2p_outbound_entry(smp2p, entry, node);
594-
if (ret < 0)
599+
if (ret < 0) {
600+
of_node_put(node);
595601
goto unwind_interfaces;
602+
}
596603

597604
list_add(&entry->node, &smp2p->outbound);
598605
}

0 commit comments

Comments
 (0)