On Mon, 2020-12-28 at 09:21 -0300, Ezequiel Garcia wrote: > No locking is needed to call video_unregister_device(). Drop it. The commit message should probably also mention that the superfluous video_is_registered() check is dropped and media_entity_cleanup() and video_unregister_device() are reordered. > Signed-off-by: Ezequiel Garcia <ezequiel@xxxxxxxxxxxxx> > --- > drivers/staging/media/imx/imx-media-capture.c | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > > diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c > index c1931eb2540e..e10ce103a5b4 100644 > --- a/drivers/staging/media/imx/imx-media-capture.c > +++ b/drivers/staging/media/imx/imx-media-capture.c > @@ -816,14 +816,8 @@ void imx_media_capture_device_unregister(struct imx_media_video_dev *vdev) > struct capture_priv *priv = to_capture_priv(vdev); > struct video_device *vfd = priv->vdev.vfd; > > - mutex_lock(&priv->mutex); > - > - if (video_is_registered(vfd)) { > - video_unregister_device(vfd); > - media_entity_cleanup(&vfd->entity); > - } > - > - mutex_unlock(&priv->mutex); > + media_entity_cleanup(&vfd->entity); > + video_unregister_device(vfd); > } > EXPORT_SYMBOL_GPL(imx_media_capture_device_unregister); regards Philipp