Skip to content

Commit b28fd17

Browse files
jhovoldgregkh
authored andcommitted
soc: qcom: ocmem: fix device leak on lookup
commit b5c16ea upstream. Make sure to drop the reference taken to the ocmem platform device when looking up its driver data. Note that holding a reference to a device does not prevent its driver data from going away so there is no point in keeping the reference. Also note that commit 0ff0270 ("soc: qcom: ocmem: Fix missing put_device() call in of_get_ocmem") fixed the leak in a lookup error path, but the reference is still leaking on success. Fixes: 88c1e94 ("soc: qcom: add OCMEM driver") Cc: stable@vger.kernel.org # 5.5: 0ff0270 Cc: Brian Masney <bmasney@redhat.com> Cc: Miaoqian Lin <linmq006@gmail.com> Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Brian Masney <bmasney@redhat.com> Link: https://lore.kernel.org/r/20250926143511.6715-2-johan@kernel.org Signed-off-by: Bjorn Andersson <andersson@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9515153 commit b28fd17

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/soc/qcom/ocmem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ struct ocmem *of_get_ocmem(struct device *dev)
202202
}
203203

204204
ocmem = platform_get_drvdata(pdev);
205+
put_device(&pdev->dev);
205206
if (!ocmem) {
206207
dev_err(dev, "Cannot get ocmem\n");
207-
put_device(&pdev->dev);
208208
return ERR_PTR(-ENODEV);
209209
}
210210
return ocmem;

0 commit comments

Comments
 (0)