From c56d34a73ea3622fbc3f5a85140f2353f14b591c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 21 Mar 2016 10:30:33 -0300 Subject: [PATCH] [media] drivers/media/media-device: move debug log before _devnode_unregister() After media_devnode_unregister(), the struct media_device may be freed already, and dereferencing it may crash. Signed-off-by: Max Kellermann Signed-off-by: Mauro Carvalho Chehab --- drivers/media/media-device.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 898a3cf..de92a6b 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -801,9 +801,8 @@ void media_device_unregister(struct media_device *mdev) mutex_unlock(&mdev->graph_mutex); device_remove_file(&mdev->devnode.dev, &dev_attr_model); + dev_dbg(mdev->dev, "Media device unregistering\n"); media_devnode_unregister(&mdev->devnode); - - dev_dbg(mdev->dev, "Media device unregistered\n"); } EXPORT_SYMBOL_GPL(media_device_unregister); -- 2.7.4