[PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function

Subsystems: remote processor (remoteproc) subsystem, the rest

STALE1737d LANDED

Landed in mainline as 4da96175014b on 2021-11-17.

6 messages, 3 authors, 2021-11-11 · open the first message on its own page

[PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function

From: Christophe JAILLET <hidden>
Date: 2021-10-16 06:44:39

'priv->workqueue' is destroyed in the error handling path of the probe but
not in the remove function.

Add the missing call to release some resources.

Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox")
Signed-off-by: Christophe JAILLET <redacted>
---
This patch is speculative. I'm not sure if the added function call is at
the right place in the remove function.
Review with care.
---
 drivers/remoteproc/imx_rproc.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index ff8170dbbc3c..0a45bc0d3f73 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -804,6 +804,7 @@ static int imx_rproc_remove(struct platform_device *pdev)
 	clk_disable_unprepare(priv->clk);
 	rproc_del(rproc);
 	imx_rproc_free_mbox(rproc);
+	destroy_workqueue(priv->workqueue);
 	rproc_free(rproc);
 
 	return 0;
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function

From: Mathieu Poirier <mathieu.poirier@linaro.org>
Date: 2021-10-21 17:41:14

On Sat, Oct 16, 2021 at 08:44:28AM +0200, Christophe JAILLET wrote:
quoted hunk
'priv->workqueue' is destroyed in the error handling path of the probe but
not in the remove function.

Add the missing call to release some resources.

Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox")
Signed-off-by: Christophe JAILLET <redacted>
---
This patch is speculative. I'm not sure if the added function call is at
the right place in the remove function.
Review with care.
---
 drivers/remoteproc/imx_rproc.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index ff8170dbbc3c..0a45bc0d3f73 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -804,6 +804,7 @@ static int imx_rproc_remove(struct platform_device *pdev)
 	clk_disable_unprepare(priv->clk);
 	rproc_del(rproc);
 	imx_rproc_free_mbox(rproc);
+	destroy_workqueue(priv->workqueue);
This seems to be the right thing to do. Peng - please review and test on your
side.

Thanks,
Mathieu
 	rproc_free(rproc);
 
 	return 0;
-- 
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

RE: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function

From: Peng Fan <peng.fan@nxp.com>
Date: 2021-11-10 08:45:34

Subject: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove
function

'priv->workqueue' is destroyed in the error handling path of the probe but not
in the remove function.

Add the missing call to release some resources.

Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox")
Signed-off-by: Christophe JAILLET <redacted>

Tested-by: Peng Fan <peng.fan@nxp.com>
quoted hunk
---
This patch is speculative. I'm not sure if the added function call is at the right
place in the remove function.
Review with care.
---
 drivers/remoteproc/imx_rproc.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/remoteproc/imx_rproc.c
b/drivers/remoteproc/imx_rproc.c index ff8170dbbc3c..0a45bc0d3f73
100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -804,6 +804,7 @@ static int imx_rproc_remove(struct platform_device
*pdev)
 	clk_disable_unprepare(priv->clk);
 	rproc_del(rproc);
 	imx_rproc_free_mbox(rproc);
+	destroy_workqueue(priv->workqueue);
 	rproc_free(rproc);

 	return 0;
--
2.30.2

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

RE: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function

From: Peng Fan <peng.fan@nxp.com>
Date: 2021-11-10 08:53:27

Subject: Re: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the
remove function

On Sat, Oct 16, 2021 at 08:44:28AM +0200, Christophe JAILLET wrote:
quoted
'priv->workqueue' is destroyed in the error handling path of the probe
but not in the remove function.

Add the missing call to release some resources.

Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox")
Signed-off-by: Christophe JAILLET <redacted>
---
This patch is speculative. I'm not sure if the added function call is
at the right place in the remove function.
Review with care.
---
 drivers/remoteproc/imx_rproc.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/remoteproc/imx_rproc.c
b/drivers/remoteproc/imx_rproc.c index ff8170dbbc3c..0a45bc0d3f73
100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -804,6 +804,7 @@ static int imx_rproc_remove(struct platform_device
*pdev)
quoted
 	clk_disable_unprepare(priv->clk);
 	rproc_del(rproc);
 	imx_rproc_free_mbox(rproc);
+	destroy_workqueue(priv->workqueue);
This seems to be the right thing to do. Peng - please review and test on your
side.
Sorry for late reply, I built the driver as a module with this patch. And no issue found.

THnaks,
Peng.
Thanks,
Mathieu
quoted
 	rproc_free(rproc);

 	return 0;
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

RE: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function

From: Peng Fan <peng.fan@nxp.com>
Date: 2021-11-10 08:54:13

Subject: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove
function

'priv->workqueue' is destroyed in the error handling path of the probe but not
in the remove function.

Add the missing call to release some resources.

Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox")
Signed-off-by: Christophe JAILLET <redacted>
Reviewed-and-Tested-by: Peng Fan [off-list ref]
quoted hunk
---
This patch is speculative. I'm not sure if the added function call is at the right
place in the remove function.
Review with care.
---
 drivers/remoteproc/imx_rproc.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/remoteproc/imx_rproc.c
b/drivers/remoteproc/imx_rproc.c index ff8170dbbc3c..0a45bc0d3f73
100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -804,6 +804,7 @@ static int imx_rproc_remove(struct platform_device
*pdev)
 	clk_disable_unprepare(priv->clk);
 	rproc_del(rproc);
 	imx_rproc_free_mbox(rproc);
+	destroy_workqueue(priv->workqueue);
 	rproc_free(rproc);

 	return 0;
--
2.30.2

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove function

From: Mathieu Poirier <mathieu.poirier@linaro.org>
Date: 2021-11-11 18:20:37

On Wed, 10 Nov 2021 at 01:54, Peng Fan [off-list ref] wrote:
quoted
Subject: [PATCH] remoteproc: imx_rproc: Fix a resource leak in the remove
function

'priv->workqueue' is destroyed in the error handling path of the probe but not
in the remove function.

Add the missing call to release some resources.

Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox")
Signed-off-by: Christophe JAILLET <redacted>
Reviewed-and-Tested-by: Peng Fan [off-list ref]
Thank you for that - I will pick up this patch when -rc1 or -rc2 gets released.

Thanks,
Mathieu
quoted
---
This patch is speculative. I'm not sure if the added function call is at the right
place in the remove function.
Review with care.
---
 drivers/remoteproc/imx_rproc.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/remoteproc/imx_rproc.c
b/drivers/remoteproc/imx_rproc.c index ff8170dbbc3c..0a45bc0d3f73
100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -804,6 +804,7 @@ static int imx_rproc_remove(struct platform_device
*pdev)
      clk_disable_unprepare(priv->clk);
      rproc_del(rproc);
      imx_rproc_free_mbox(rproc);
+     destroy_workqueue(priv->workqueue);
      rproc_free(rproc);

      return 0;
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help