]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.9/media-ipu3-cio2-unregister-device-nodes-first-then-r.patch
drop queue-4.14/mips-make-sure-dt-memory-regions-are-valid.patch
[thirdparty/kernel/stable-queue.git] / releases / 4.19.9 / media-ipu3-cio2-unregister-device-nodes-first-then-r.patch
1 From 7f4a5db8a2e6ff35089a1c99b3d16d62bd036425 Mon Sep 17 00:00:00 2001
2 From: Sakari Ailus <sakari.ailus@linux.intel.com>
3 Date: Wed, 10 Oct 2018 04:01:05 -0400
4 Subject: media: ipu3-cio2: Unregister device nodes first, then release
5 resources
6
7 [ Upstream commit 32388d6ef7cffc7d8291b67f8dfa26acd45217fd ]
8
9 While there are issues related to object lifetime management, unregister
10 the media device first, followed immediately by other device nodes when
11 the driver is being unbound. Only then the resources needed by the driver
12 may be released. This is slightly safer.
13
14 Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
15 Tested-by: Bingbu Cao <bingbu.cao@intel.com>
16 Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
17 Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
18 Signed-off-by: Sasha Levin <sashal@kernel.org>
19 ---
20 drivers/media/pci/intel/ipu3/ipu3-cio2.c | 4 ++--
21 1 file changed, 2 insertions(+), 2 deletions(-)
22
23 diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
24 index 29027159eced..ca1a4d8e972e 100644
25 --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
26 +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
27 @@ -1846,12 +1846,12 @@ static void cio2_pci_remove(struct pci_dev *pci_dev)
28 struct cio2_device *cio2 = pci_get_drvdata(pci_dev);
29 unsigned int i;
30
31 + media_device_unregister(&cio2->media_dev);
32 cio2_notifier_exit(cio2);
33 - cio2_fbpt_exit_dummy(cio2);
34 for (i = 0; i < CIO2_QUEUES; i++)
35 cio2_queue_exit(cio2, &cio2->queue[i]);
36 + cio2_fbpt_exit_dummy(cio2);
37 v4l2_device_unregister(&cio2->v4l2_dev);
38 - media_device_unregister(&cio2->media_dev);
39 media_device_cleanup(&cio2->media_dev);
40 mutex_destroy(&cio2->lock);
41 }
42 --
43 2.19.1
44