提交 0ff02702 编写于 作者: M Miaoqian Lin 提交者: Bjorn Andersson

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: 01f937ff ("soc: qcom: ocmem: don't return NULL in of_get_ocmem")
Signed-off-by: NMiaoqian Lin <linmq006@gmail.com>
Signed-off-by: NBjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220107073126.2335-1-linmq006@gmail.com
上级 5a811126
...@@ -206,6 +206,7 @@ struct ocmem *of_get_ocmem(struct device *dev) ...@@ -206,6 +206,7 @@ struct ocmem *of_get_ocmem(struct device *dev)
ocmem = platform_get_drvdata(pdev); ocmem = platform_get_drvdata(pdev);
if (!ocmem) { if (!ocmem) {
dev_err(dev, "Cannot get ocmem\n"); dev_err(dev, "Cannot get ocmem\n");
put_device(&pdev->dev);
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
} }
return ocmem; return ocmem;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册