summaryrefslogtreecommitdiff
path: root/drivers/soc/qcom/ocmem.c
diff options
context:
space:
mode:
authorMiaoqian Lin <linmq006@gmail.com>2022-01-07 07:31:26 +0000
committerBjorn Andersson <bjorn.andersson@linaro.org>2022-01-31 16:09:50 -0600
commit0ff027027e05a866491bbb53494f0e2a61354c85 (patch)
treec4e4394bb70cf2105bb67f65c9d7ebe2f75f84ac /drivers/soc/qcom/ocmem.c
parent5a811126d38f9767a20cc271b34db7c8efc5a46c (diff)
soc: qcom: ocmem: Fix missing put_device() call in of_get_ocmem
The reference taken by 'of_find_device_by_node()' must be released when not needed anymore. Add the corresponding 'put_device()' in the error handling path. Fixes: 01f937ffc468 ("soc: qcom: ocmem: don't return NULL in of_get_ocmem") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220107073126.2335-1-linmq006@gmail.com
Diffstat (limited to 'drivers/soc/qcom/ocmem.c')
-rw-r--r--drivers/soc/qcom/ocmem.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/soc/qcom/ocmem.c b/drivers/soc/qcom/ocmem.c
index d2dacbbaafbd..97fd24c178f8 100644
--- a/drivers/soc/qcom/ocmem.c
+++ b/drivers/soc/qcom/ocmem.c
@@ -206,6 +206,7 @@ struct ocmem *of_get_ocmem(struct device *dev)
ocmem = platform_get_drvdata(pdev);
if (!ocmem) {
dev_err(dev, "Cannot get ocmem\n");
+ put_device(&pdev->dev);
return ERR_PTR(-ENODEV);
}
return ocmem;