Commit f84263bf authored by Sakari Ailus's avatar Sakari Ailus Committed by Greg Kroah-Hartman

media: ipu3-cio2: Unregister device nodes first, then release resources

[ Upstream commit 32388d6e ]

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: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: default avatarBingbu Cao <bingbu.cao@intel.com>
Reviewed-by: default avatarBingbu Cao <bingbu.cao@intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 61880fb5
...@@ -1846,12 +1846,12 @@ static void cio2_pci_remove(struct pci_dev *pci_dev) ...@@ -1846,12 +1846,12 @@ static void cio2_pci_remove(struct pci_dev *pci_dev)
struct cio2_device *cio2 = pci_get_drvdata(pci_dev); struct cio2_device *cio2 = pci_get_drvdata(pci_dev);
unsigned int i; unsigned int i;
media_device_unregister(&cio2->media_dev);
cio2_notifier_exit(cio2); cio2_notifier_exit(cio2);
cio2_fbpt_exit_dummy(cio2);
for (i = 0; i < CIO2_QUEUES; i++) for (i = 0; i < CIO2_QUEUES; i++)
cio2_queue_exit(cio2, &cio2->queue[i]); cio2_queue_exit(cio2, &cio2->queue[i]);
cio2_fbpt_exit_dummy(cio2);
v4l2_device_unregister(&cio2->v4l2_dev); v4l2_device_unregister(&cio2->v4l2_dev);
media_device_unregister(&cio2->media_dev);
media_device_cleanup(&cio2->media_dev); media_device_cleanup(&cio2->media_dev);
mutex_destroy(&cio2->lock); mutex_destroy(&cio2->lock);
} }
......
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