Skip to content

Commit

Permalink
media: bdisp: add missed destroy_workqueue in remove and probe failure
Browse files Browse the repository at this point in the history
The driver forgets to call destroy_workqueue when remove and probe fails.
Add the missed calls to fix it.

Signed-off-by: Chuhong Yuan <[email protected]>
Reviewed-by: Fabien Dessenne <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
WillLester authored and mchehab committed Dec 13, 2019
1 parent 569bc8d commit 8ea1c5a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions drivers/media/platform/sti/bdisp/bdisp-v4l2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,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;
Expand Down Expand Up @@ -1317,20 +1319,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);
Expand Down Expand Up @@ -1402,7 +1406,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;
}

Expand Down

0 comments on commit 8ea1c5a

Please sign in to comment.