summaryrefslogtreecommitdiff
path: root/drivers/bus
diff options
context:
space:
mode:
authorPan Bian <bianpan2016@163.com>2021-01-21 14:49:07 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-22 11:57:28 +0300
commit94810fc52925eb122a922df7f9966cf3f4ba7391 (patch)
tree0c439fd4b4c0936a3ba50f0147f88084b3fcdd94 /drivers/bus
parentf73b29819c6314c0ba8b7d5892dfb03487424bee (diff)
downloadlinux-94810fc52925eb122a922df7f9966cf3f4ba7391.tar.xz
bus: qcom: Put child node before return
[ Upstream commit ac6ad7c2a862d682bb584a4bc904d89fa7721af8 ] Put child node before return to fix potential reference count leak. Generally, the reference count of child is incremented and decremented automatically in the macro for_each_available_child_of_node() and should be decremented manually if the loop is broken in loop body. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Fixes: 335a12754808 ("bus: qcom: add EBI2 driver") Signed-off-by: Pan Bian <bianpan2016@163.com> Link: https://lore.kernel.org/r/20210121114907.109267-1-bianpan2016@163.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/bus')
-rw-r--r--drivers/bus/qcom-ebi2.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/bus/qcom-ebi2.c b/drivers/bus/qcom-ebi2.c
index a6444244c411..bfb67aa00bec 100644
--- a/drivers/bus/qcom-ebi2.c
+++ b/drivers/bus/qcom-ebi2.c
@@ -357,8 +357,10 @@ static int qcom_ebi2_probe(struct platform_device *pdev)
/* Figure out the chipselect */
ret = of_property_read_u32(child, "reg", &csindex);
- if (ret)
+ if (ret) {
+ of_node_put(child);
return ret;
+ }
if (csindex > 5) {
dev_err(dev,