diff options
author | Wan Jiabing <wanjiabing@vivo.com> | 2021-10-14 02:23:49 -0400 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2021-10-24 12:14:52 -0500 |
commit | e1b391e9712db4880394e727ae623b96ee18d618 (patch) | |
tree | f8e8401966c9ca021aa93fdcd351d3c5e7887288 /drivers/soc/qcom | |
parent | 72f1aa6205d84337b90b065f602a8fe190821781 (diff) | |
download | linux-stable-e1b391e9712db4880394e727ae623b96ee18d618.tar.gz linux-stable-e1b391e9712db4880394e727ae623b96ee18d618.tar.bz2 linux-stable-e1b391e9712db4880394e727ae623b96ee18d618.zip |
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 <wanjiabing@vivo.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20211014062350.8942-1-wanjiabing@vivo.com
Diffstat (limited to 'drivers/soc/qcom')
-rw-r--r-- | drivers/soc/qcom/smp2p.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c index 11b95113e38e..4a157240f419 100644 --- a/drivers/soc/qcom/smp2p.c +++ b/drivers/soc/qcom/smp2p.c @@ -573,6 +573,7 @@ static int qcom_smp2p_probe(struct platform_device *pdev) entry = devm_kzalloc(&pdev->dev, sizeof(*entry), GFP_KERNEL); if (!entry) { ret = -ENOMEM; + of_node_put(node); goto unwind_interfaces; } @@ -580,19 +581,25 @@ static int qcom_smp2p_probe(struct platform_device *pdev) spin_lock_init(&entry->lock); ret = of_property_read_string(node, "qcom,entry-name", &entry->name); - if (ret < 0) + if (ret < 0) { + of_node_put(node); goto unwind_interfaces; + } if (of_property_read_bool(node, "interrupt-controller")) { ret = qcom_smp2p_inbound_entry(smp2p, entry, node); - if (ret < 0) + if (ret < 0) { + of_node_put(node); goto unwind_interfaces; + } list_add(&entry->node, &smp2p->inbound); } else { ret = qcom_smp2p_outbound_entry(smp2p, entry, node); - if (ret < 0) + if (ret < 0) { + of_node_put(node); goto unwind_interfaces; + } list_add(&entry->node, &smp2p->outbound); } |