Commit 730b2ad8 authored by Sibi Sankar's avatar Sibi Sankar Committed by Bjorn Andersson

remoteproc: fix null pointer dereference on glink only platforms

Currently calling list_del on smd subdev remove path results in
null pointer dereference on glink only platforms. Fix this by
adding safety checks in glink/smd subdev remove paths.
Signed-off-by: default avatarSibi Sankar <sibis@codeaurora.org>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent dea4bd19
...@@ -75,6 +75,9 @@ EXPORT_SYMBOL_GPL(qcom_add_glink_subdev); ...@@ -75,6 +75,9 @@ EXPORT_SYMBOL_GPL(qcom_add_glink_subdev);
*/ */
void qcom_remove_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink) void qcom_remove_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink)
{ {
if (!glink->node)
return;
rproc_remove_subdev(rproc, &glink->subdev); rproc_remove_subdev(rproc, &glink->subdev);
of_node_put(glink->node); of_node_put(glink->node);
} }
...@@ -165,6 +168,9 @@ EXPORT_SYMBOL_GPL(qcom_add_smd_subdev); ...@@ -165,6 +168,9 @@ EXPORT_SYMBOL_GPL(qcom_add_smd_subdev);
*/ */
void qcom_remove_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd) void qcom_remove_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd)
{ {
if (!smd->node)
return;
rproc_remove_subdev(rproc, &smd->subdev); rproc_remove_subdev(rproc, &smd->subdev);
of_node_put(smd->node); of_node_put(smd->node);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment