Skip to content

Commit 78ee559

Browse files
jhovoldAndy Gross
authored andcommitted
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: d1de6d6 ("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>
1 parent 4da3b04 commit 78ee559

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎drivers/soc/qcom/rmtfs_mem.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev)
184184
device_initialize(&rmtfs_mem->dev);
185185
rmtfs_mem->dev.parent = &pdev->dev;
186186
rmtfs_mem->dev.groups = qcom_rmtfs_mem_groups;
187+
rmtfs_mem->dev.release = qcom_rmtfs_mem_release_device;
187188

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

209-
rmtfs_mem->dev.release = qcom_rmtfs_mem_release_device;
210-
211210
ret = of_property_read_u32(node, "qcom,vmid", &vmid);
212211
if (ret < 0 && ret != -EINVAL) {
213212
dev_err(&pdev->dev, "failed to parse qcom,vmid\n");

0 commit comments

Comments
 (0)