2019-10-04 22:29:10

by Bjorn Andersson

[permalink] [raw]
Subject: [PATCH v2 6/6] rpmsg: glink: Free pending deferred work on remove

By just cancelling the deferred rx worker during GLINK instance teardown
any pending deferred commands are leaked, so free them.

Fixes: b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver")
Cc: [email protected]
Tested-by: Srinivas Kandagatla <[email protected]>
Signed-off-by: Bjorn Andersson <[email protected]>
---

Changes since v1:
- None

drivers/rpmsg/qcom_glink_native.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 4117818db6a1..862f89c128a0 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -1562,6 +1562,18 @@ static void qcom_glink_work(struct work_struct *work)
}
}

+static void qcom_glink_cancel_rx_work(struct qcom_glink *glink)
+{
+ struct glink_defer_cmd *dcmd;
+ struct glink_defer_cmd *tmp;
+
+ /* cancel any pending deferred rx_work */
+ cancel_work_sync(&glink->rx_work);
+
+ list_for_each_entry_safe(dcmd, tmp, &glink->rx_queue, node)
+ kfree(dcmd);
+}
+
struct qcom_glink *qcom_glink_native_probe(struct device *dev,
unsigned long features,
struct qcom_glink_pipe *rx,
@@ -1640,7 +1652,7 @@ void qcom_glink_native_remove(struct qcom_glink *glink)
unsigned long flags;

disable_irq(glink->irq);
- cancel_work_sync(&glink->rx_work);
+ qcom_glink_cancel_rx_work(glink);

ret = device_for_each_child(glink->dev, NULL, qcom_glink_remove_device);
if (ret)
--
2.18.0


2019-10-09 01:18:32

by Chris Lew

[permalink] [raw]
Subject: Re: [PATCH v2 6/6] rpmsg: glink: Free pending deferred work on remove



On 10/4/2019 3:27 PM, Bjorn Andersson wrote:
> By just cancelling the deferred rx worker during GLINK instance teardown
> any pending deferred commands are leaked, so free them.
>
> Fixes: b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver")
> Cc: [email protected]
> Tested-by: Srinivas Kandagatla <[email protected]>
> Signed-off-by: Bjorn Andersson <[email protected]>
> ---
Acked-By: Chris Lew <[email protected]>

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project