aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2018-06-12 08:41:41 -0400
committerAndy Gross <andy.gross@linaro.org>2018-07-21 15:53:47 -0400
commit78ee559d7fc65e37670a46cfbeaaa62cb014af67 (patch)
tree140cc553fac52324a07dd69fe557db7fec3105c4
parent4da3b0452bc66af8feca71b176668faf3d0e750d (diff)
soc: qcom: rmtfs-mem: fix memleak in probe error paths
Make sure to set the mem device release callback before calling put_device() in a couple of probe error paths so that the containing object also gets freed. Fixes: d1de6d6c639b ("soc: qcom: Remote filesystem memory driver") Cc: stable <stable@vger.kernel.org> # 4.15 Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Andy Gross <andy.gross@linaro.org>
-rw-r--r--drivers/soc/qcom/rmtfs_mem.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c
index c8999e38b005..8a3678c2e83c 100644
--- a/drivers/soc/qcom/rmtfs_mem.c
+++ b/drivers/soc/qcom/rmtfs_mem.c
@@ -184,6 +184,7 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev)
184 device_initialize(&rmtfs_mem->dev); 184 device_initialize(&rmtfs_mem->dev);
185 rmtfs_mem->dev.parent = &pdev->dev; 185 rmtfs_mem->dev.parent = &pdev->dev;
186 rmtfs_mem->dev.groups = qcom_rmtfs_mem_groups; 186 rmtfs_mem->dev.groups = qcom_rmtfs_mem_groups;
187 rmtfs_mem->dev.release = qcom_rmtfs_mem_release_device;
187 188
188 rmtfs_mem->base = devm_memremap(&rmtfs_mem->dev, rmtfs_mem->addr, 189 rmtfs_mem->base = devm_memremap(&rmtfs_mem->dev, rmtfs_mem->addr,
189 rmtfs_mem->size, MEMREMAP_WC); 190 rmtfs_mem->size, MEMREMAP_WC);
@@ -206,8 +207,6 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev)
206 goto put_device; 207 goto put_device;
207 } 208 }
208 209
209 rmtfs_mem->dev.release = qcom_rmtfs_mem_release_device;
210
211 ret = of_property_read_u32(node, "qcom,vmid", &vmid); 210 ret = of_property_read_u32(node, "qcom,vmid", &vmid);
212 if (ret < 0 && ret != -EINVAL) { 211 if (ret < 0 && ret != -EINVAL) {
213 dev_err(&pdev->dev, "failed to parse qcom,vmid\n"); 212 dev_err(&pdev->dev, "failed to parse qcom,vmid\n");