Commit 959bba13 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: vivid: two unregistration fixes

When the media device registration fails, don't call media_device_unregister
since the device was never actually registered.

When removing the module also call media_device_cleanup() to avoid a memory leak.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent dd1df35d
...@@ -1478,9 +1478,6 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) ...@@ -1478,9 +1478,6 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
return 0; return 0;
unreg_dev: unreg_dev:
#ifdef CONFIG_MEDIA_CONTROLLER
media_device_unregister(&dev->mdev);
#endif
video_unregister_device(&dev->radio_tx_dev); video_unregister_device(&dev->radio_tx_dev);
video_unregister_device(&dev->radio_rx_dev); video_unregister_device(&dev->radio_rx_dev);
video_unregister_device(&dev->sdr_cap_dev); video_unregister_device(&dev->sdr_cap_dev);
...@@ -1553,6 +1550,7 @@ static int vivid_remove(struct platform_device *pdev) ...@@ -1553,6 +1550,7 @@ static int vivid_remove(struct platform_device *pdev)
#ifdef CONFIG_MEDIA_CONTROLLER #ifdef CONFIG_MEDIA_CONTROLLER
media_device_unregister(&dev->mdev); media_device_unregister(&dev->mdev);
media_device_cleanup(&dev->mdev);
#endif #endif
if (dev->has_vid_cap) { if (dev->has_vid_cap) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment