diff options
author | Pan Bian <[email protected]> | 2021-01-21 03:49:07 -0800 |
---|---|---|
committer | Bjorn Andersson <[email protected]> | 2021-03-29 22:01:27 -0500 |
commit | ac6ad7c2a862d682bb584a4bc904d89fa7721af8 (patch) | |
tree | a4f491a3caf7930ca08a5569f837d081ba622b8e | |
parent | ddd6b7267fe6e3c5a48e2e4eda18f354595c6d65 (diff) |
bus: qcom: Put child node before return
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 <[email protected]>
Fixes: 335a12754808 ("bus: qcom: add EBI2 driver")
Signed-off-by: Pan Bian <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Bjorn Andersson <[email protected]>
-rw-r--r-- | drivers/bus/qcom-ebi2.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/bus/qcom-ebi2.c b/drivers/bus/qcom-ebi2.c index 03ddcf426887..0b8f53a688b8 100644 --- a/drivers/bus/qcom-ebi2.c +++ b/drivers/bus/qcom-ebi2.c @@ -353,8 +353,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, |