summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorEzequiel Garcia <ezequiel@vanguardiasur.com.ar>2015-09-28 23:36:51 +0200
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-10-03 16:35:44 +0200
commita5d42b8c3b3ddccd88dc1c70957177d31a6699fb (patch)
treeeb5ab024663ff8cd730204be0ee5420a6e0b4eeb /drivers/media
parent[media] media: am437x-vpfe: fix handling platform_get_irq result (diff)
downloadlinux-a5d42b8c3b3ddccd88dc1c70957177d31a6699fb.tar.xz
linux-a5d42b8c3b3ddccd88dc1c70957177d31a6699fb.zip
[media] vivid: Fix iteration in driver removal path
When the diver is removed and all the resources are deallocated, we should be iterating through the created devices only. Currently, the iteration ends when vivid_devs[i] is NULL. Since the array contains VIVID_MAX_DEVS elements, it will oops if n_devs=VIVID_MAX_DEVS because in that case, no element is NULL. Fixes: c88a96b023d8 ('[media] vivid: add core driver code') Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/vivid/vivid-core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/media/platform/vivid/vivid-core.c b/drivers/media/platform/vivid/vivid-core.c
index a047b4716741..0f5e9143cc7e 100644
--- a/drivers/media/platform/vivid/vivid-core.c
+++ b/drivers/media/platform/vivid/vivid-core.c
@@ -1341,8 +1341,11 @@ static int vivid_remove(struct platform_device *pdev)
struct vivid_dev *dev;
unsigned i;
- for (i = 0; vivid_devs[i]; i++) {
+
+ for (i = 0; i < n_devs; i++) {
dev = vivid_devs[i];
+ if (!dev)
+ continue;
if (dev->has_vid_cap) {
v4l2_info(&dev->v4l2_dev, "unregistering %s\n",