Skip to content

Commit

Permalink
soc: qcom: rmtfs-mem: fix memleak in probe error paths
Browse files Browse the repository at this point in the history
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: d1de6d6 ("soc: qcom: Remote filesystem memory driver")
Cc: stable <[email protected]>     # 4.15
Cc: Bjorn Andersson <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Andy Gross <[email protected]>
  • Loading branch information
jhovold authored and Andy Gross committed Jul 21, 2018
1 parent 4da3b04 commit 78ee559
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/soc/qcom/rmtfs_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev)
device_initialize(&rmtfs_mem->dev);
rmtfs_mem->dev.parent = &pdev->dev;
rmtfs_mem->dev.groups = qcom_rmtfs_mem_groups;
rmtfs_mem->dev.release = qcom_rmtfs_mem_release_device;

rmtfs_mem->base = devm_memremap(&rmtfs_mem->dev, rmtfs_mem->addr,
rmtfs_mem->size, MEMREMAP_WC);
Expand All @@ -206,8 +207,6 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev)
goto put_device;
}

rmtfs_mem->dev.release = qcom_rmtfs_mem_release_device;

ret = of_property_read_u32(node, "qcom,vmid", &vmid);
if (ret < 0 && ret != -EINVAL) {
dev_err(&pdev->dev, "failed to parse qcom,vmid\n");
Expand Down

0 comments on commit 78ee559

Please sign in to comment.