[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220107073126.2335-1-linmq006@gmail.com>
Date: Fri, 7 Jan 2022 07:31:26 +0000
From: Miaoqian Lin <linmq006@...il.com>
To: unlisted-recipients:; (no To-header on input)
Cc: linmq006@...il.com, Andy Gross <agross@...nel.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Luca Weiss <luca@...tu.xyz>,
Brian Masney <masneyb@...tation.org>,
linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] 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@...il.com>
---
drivers/soc/qcom/ocmem.c | 1 +
1 file changed, 1 insertion(+)
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;
--
2.17.1
Powered by blists - more mailing lists