* [PATCH] media: bdisp: add missed destroy_workqueue in remove and probe failure
@ 2019-11-13 6:37 Chuhong Yuan
2019-11-13 8:31 ` Fabien DESSENNE
0 siblings, 1 reply; 2+ messages in thread
From: Chuhong Yuan @ 2019-11-13 6:37 UTC (permalink / raw)
Cc: Fabien Dessenne, Mauro Carvalho Chehab, linux-media,
linux-kernel, Chuhong Yuan
The driver forgets to call destroy_workqueue when remove and probe fails.
Add the missed calls to fix it.
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
drivers/media/platform/sti/bdisp/bdisp-v4l2.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
index e90f1ba30574..4c0b36236a38 100644
--- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
+++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
@@ -1275,6 +1275,8 @@ static int bdisp_remove(struct platform_device *pdev)
if (!IS_ERR(bdisp->clock))
clk_unprepare(bdisp->clock);
+ destroy_workqueue(bdisp->work_queue);
+
dev_dbg(&pdev->dev, "%s driver unloaded\n", pdev->name);
return 0;
@@ -1318,20 +1320,22 @@ static int bdisp_probe(struct platform_device *pdev)
bdisp->regs = devm_ioremap_resource(dev, res);
if (IS_ERR(bdisp->regs)) {
dev_err(dev, "failed to get regs\n");
- return PTR_ERR(bdisp->regs);
+ ret = PTR_ERR(bdisp->regs);
+ goto err_wq;
}
bdisp->clock = devm_clk_get(dev, BDISP_NAME);
if (IS_ERR(bdisp->clock)) {
dev_err(dev, "failed to get clock\n");
- return PTR_ERR(bdisp->clock);
+ ret = PTR_ERR(bdisp->clock);
+ goto err_wq;
}
ret = clk_prepare(bdisp->clock);
if (ret < 0) {
dev_err(dev, "clock prepare failed\n");
bdisp->clock = ERR_PTR(-EINVAL);
- return ret;
+ goto err_wq;
}
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
@@ -1403,7 +1407,8 @@ static int bdisp_probe(struct platform_device *pdev)
err_clk:
if (!IS_ERR(bdisp->clock))
clk_unprepare(bdisp->clock);
-
+err_wq:
+ destroy_workqueue(bdisp->work_queue);
return ret;
}
--
2.23.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] media: bdisp: add missed destroy_workqueue in remove and probe failure
2019-11-13 6:37 [PATCH] media: bdisp: add missed destroy_workqueue in remove and probe failure Chuhong Yuan
@ 2019-11-13 8:31 ` Fabien DESSENNE
0 siblings, 0 replies; 2+ messages in thread
From: Fabien DESSENNE @ 2019-11-13 8:31 UTC (permalink / raw)
To: Chuhong Yuan; +Cc: Mauro Carvalho Chehab, linux-media, linux-kernel
Hi Chuhong,
Thank you for the patch.
On 13/11/2019 7:37 AM, Chuhong Yuan wrote:
> The driver forgets to call destroy_workqueue when remove and probe fails.
> Add the missed calls to fix it.
>
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
> ---
> drivers/media/platform/sti/bdisp/bdisp-v4l2.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
> index e90f1ba30574..4c0b36236a38 100644
> --- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
> +++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
> @@ -1275,6 +1275,8 @@ static int bdisp_remove(struct platform_device *pdev)
> if (!IS_ERR(bdisp->clock))
> clk_unprepare(bdisp->clock);
>
> + destroy_workqueue(bdisp->work_queue);
> +
> dev_dbg(&pdev->dev, "%s driver unloaded\n", pdev->name);
>
> return 0;
> @@ -1318,20 +1320,22 @@ static int bdisp_probe(struct platform_device *pdev)
> bdisp->regs = devm_ioremap_resource(dev, res);
> if (IS_ERR(bdisp->regs)) {
> dev_err(dev, "failed to get regs\n");
> - return PTR_ERR(bdisp->regs);
> + ret = PTR_ERR(bdisp->regs);
> + goto err_wq;
> }
>
> bdisp->clock = devm_clk_get(dev, BDISP_NAME);
> if (IS_ERR(bdisp->clock)) {
> dev_err(dev, "failed to get clock\n");
> - return PTR_ERR(bdisp->clock);
> + ret = PTR_ERR(bdisp->clock);
> + goto err_wq;
> }
>
> ret = clk_prepare(bdisp->clock);
> if (ret < 0) {
> dev_err(dev, "clock prepare failed\n");
> bdisp->clock = ERR_PTR(-EINVAL);
> - return ret;
> + goto err_wq;
> }
>
> res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> @@ -1403,7 +1407,8 @@ static int bdisp_probe(struct platform_device *pdev)
> err_clk:
> if (!IS_ERR(bdisp->clock))
> clk_unprepare(bdisp->clock);
> -
> +err_wq:
> + destroy_workqueue(bdisp->work_queue);
> return ret;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-13 8:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 6:37 [PATCH] media: bdisp: add missed destroy_workqueue in remove and probe failure Chuhong Yuan
2019-11-13 8:31 ` Fabien DESSENNE
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).