aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2018-10-10 04:01:05 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-11-06 07:11:36 -0500
commit32388d6ef7cffc7d8291b67f8dfa26acd45217fd (patch)
treeff171517d00b57f627ce46823356bf25a5cec99c
parent30efae3d789cd0714ef795545a46749236e29558 (diff)
media: ipu3-cio2: Unregister device nodes first, then release resources
While there are issues related to object lifetime management, unregister the media device first, followed immediately by other device nodes when the driver is being unbound. Only then the resources needed by the driver may be released. This is slightly safer. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Bingbu Cao <bingbu.cao@intel.com> Reviewed-by: Bingbu Cao <bingbu.cao@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r--drivers/media/pci/intel/ipu3/ipu3-cio2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
index 452eb9b42140..723022ef3662 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -1846,12 +1846,12 @@ static void cio2_pci_remove(struct pci_dev *pci_dev)
1846 struct cio2_device *cio2 = pci_get_drvdata(pci_dev); 1846 struct cio2_device *cio2 = pci_get_drvdata(pci_dev);
1847 unsigned int i; 1847 unsigned int i;
1848 1848
1849 media_device_unregister(&cio2->media_dev);
1849 cio2_notifier_exit(cio2); 1850 cio2_notifier_exit(cio2);
1850 cio2_fbpt_exit_dummy(cio2);
1851 for (i = 0; i < CIO2_QUEUES; i++) 1851 for (i = 0; i < CIO2_QUEUES; i++)
1852 cio2_queue_exit(cio2, &cio2->queue[i]); 1852 cio2_queue_exit(cio2, &cio2->queue[i]);
1853 cio2_fbpt_exit_dummy(cio2);
1853 v4l2_device_unregister(&cio2->v4l2_dev); 1854 v4l2_device_unregister(&cio2->v4l2_dev);
1854 media_device_unregister(&cio2->media_dev);
1855 media_device_cleanup(&cio2->media_dev); 1855 media_device_cleanup(&cio2->media_dev);
1856 mutex_destroy(&cio2->lock); 1856 mutex_destroy(&cio2->lock);
1857} 1857}