Skip to content

Commit fc8670d

Browse files
Kwiboomchehab
authored andcommitted
media: rockchip/vpu: Fix/re-order probe-error/remove path
media_device_cleanup() and v4l2_m2m_unregister_media_controller() were missing in the probe error path. While at it, re-order calls in the remove path to unregister/cleanup things in the reverse order they were initialized/registered. Signed-off-by: Jonas Karlman <[email protected]> Signed-off-by: Boris Brezillon <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent f6d080f commit fc8670d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,10 +482,12 @@ static int rockchip_vpu_probe(struct platform_device *pdev)
482482
return 0;
483483
err_video_dev_unreg:
484484
if (vpu->vfd_enc) {
485+
v4l2_m2m_unregister_media_controller(vpu->m2m_dev);
485486
video_unregister_device(vpu->vfd_enc);
486487
video_device_release(vpu->vfd_enc);
487488
}
488489
err_m2m_rel:
490+
media_device_cleanup(&vpu->mdev);
489491
v4l2_m2m_release(vpu->m2m_dev);
490492
err_v4l2_unreg:
491493
v4l2_device_unregister(&vpu->v4l2_dev);
@@ -503,13 +505,13 @@ static int rockchip_vpu_remove(struct platform_device *pdev)
503505
v4l2_info(&vpu->v4l2_dev, "Removing %s\n", pdev->name);
504506

505507
media_device_unregister(&vpu->mdev);
506-
v4l2_m2m_unregister_media_controller(vpu->m2m_dev);
507-
v4l2_m2m_release(vpu->m2m_dev);
508-
media_device_cleanup(&vpu->mdev);
509508
if (vpu->vfd_enc) {
509+
v4l2_m2m_unregister_media_controller(vpu->m2m_dev);
510510
video_unregister_device(vpu->vfd_enc);
511511
video_device_release(vpu->vfd_enc);
512512
}
513+
media_device_cleanup(&vpu->mdev);
514+
v4l2_m2m_release(vpu->m2m_dev);
513515
v4l2_device_unregister(&vpu->v4l2_dev);
514516
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
515517
pm_runtime_dont_use_autosuspend(vpu->dev);

0 commit comments

Comments
 (0)