|
@@ -577,6 +577,8 @@ EXPORT_SYMBOL_GPL(__media_device_register);
|
|
* media_device_unregister - unregister a media device
|
|
* media_device_unregister - unregister a media device
|
|
* @mdev: The media device
|
|
* @mdev: The media device
|
|
*
|
|
*
|
|
|
|
+ * It is safe to call this function on an unregistered
|
|
|
|
+ * (but initialised) media device.
|
|
*/
|
|
*/
|
|
void media_device_unregister(struct media_device *mdev)
|
|
void media_device_unregister(struct media_device *mdev)
|
|
{
|
|
{
|
|
@@ -584,6 +586,10 @@ void media_device_unregister(struct media_device *mdev)
|
|
struct media_entity *next;
|
|
struct media_entity *next;
|
|
struct media_interface *intf, *tmp_intf;
|
|
struct media_interface *intf, *tmp_intf;
|
|
|
|
|
|
|
|
+ /* Check if mdev was ever registered at all */
|
|
|
|
+ if (!media_devnode_is_registered(&mdev->devnode))
|
|
|
|
+ return;
|
|
|
|
+
|
|
/* Remove all entities from the media device */
|
|
/* Remove all entities from the media device */
|
|
list_for_each_entry_safe(entity, next, &mdev->entities, graph_obj.list)
|
|
list_for_each_entry_safe(entity, next, &mdev->entities, graph_obj.list)
|
|
media_device_unregister_entity(entity);
|
|
media_device_unregister_entity(entity);
|