linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] meson: vdec: fix possible refcount leak in vdec_probe()
@ 2022-09-06  7:46 Hangyu Hua
  0 siblings, 0 replies; only message in thread
From: Hangyu Hua @ 2022-09-06  7:46 UTC (permalink / raw)
  To: narmstrong, mchehab, gregkh, khilman, jbrunet,
	martin.blumenstingl
  Cc: linux-media, linux-amlogic, linux-staging, linux-arm-kernel,
	linux-kernel, Hangyu Hua

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

Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
---
 drivers/staging/media/meson/vdec/vdec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/media/meson/vdec/vdec.c
index 8549d95be0f2..52f224d8def1 100644
--- a/drivers/staging/media/meson/vdec/vdec.c
+++ b/drivers/staging/media/meson/vdec/vdec.c
@@ -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;
 }
-- 
2.34.1


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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-06  7:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-06  7:46 [PATCH] meson: vdec: fix possible refcount leak in vdec_probe() Hangyu Hua

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).