Commit 77189993 authored by Hangyu Hua's avatar Hangyu Hua Committed by Mauro Carvalho Chehab
Browse files

media: meson: vdec: fix possible refcount leak in vdec_probe()



v4l2_device_unregister need to be called to put the refcount got by
v4l2_device_register when vdec_probe fails or vdec_remove is called.

Signed-off-by: default avatarHangyu Hua <hbh25y@gmail.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 594b6bdd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1102,6 +1102,7 @@ static int vdec_probe(struct platform_device *pdev)

err_vdev_release:
	video_device_release(vdev);
	v4l2_device_unregister(&core->v4l2_dev);
	return ret;
}

@@ -1110,6 +1111,7 @@ static int vdec_remove(struct platform_device *pdev)
	struct amvdec_core *core = platform_get_drvdata(pdev);

	video_unregister_device(core->vdev_dec);
	v4l2_device_unregister(&core->v4l2_dev);

	return 0;
}