summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-08-10 22:06:18 +0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-08-10 22:06:18 +0300
commitda2048b7348a0be92f706ac019e022139e29495e (patch)
treee3a31024b6c53f0ff1e8c3385299b29e103b8ddf /drivers/media
parent8179de98cd35242446f4c7a6ecdd73c6c41f0cfb (diff)
downloadlinux-da2048b7348a0be92f706ac019e022139e29495e.tar.xz
Revert "media: vivid: shut up warnings due to a non-trivial logic"
0day kernel testing robot got the below dmesg and the first bad commit is https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master commit 3354b54f9f7037a1122d3b6009aa9d39829d6843 [ 248.847809] BUG: unable to handle kernel paging request at ffffc90000393131 [ 248.848015] Call Trace: [ 248.848015] ? vivid_dev_release+0xc0/0xc0 [ 248.848015] ? acpi_dev_pm_attach+0x27/0xd0 This reverts commit 3354b54f9f7037a1122d3b6009aa9d39829d6843.
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/vivid/vivid-core.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/drivers/media/platform/vivid/vivid-core.c b/drivers/media/platform/vivid/vivid-core.c
index 4c235ea27987..31db363602e5 100644
--- a/drivers/media/platform/vivid/vivid-core.c
+++ b/drivers/media/platform/vivid/vivid-core.c
@@ -647,7 +647,6 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
unsigned node_type = node_types[inst];
unsigned int allocator = allocators[inst];
v4l2_std_id tvnorms_cap = 0, tvnorms_out = 0;
- char *strings_base;
int ret;
int i;
@@ -860,33 +859,17 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
/* create a string array containing the names of all the preset timings */
while (v4l2_dv_timings_presets[dev->query_dv_timings_size].bt.width)
dev->query_dv_timings_size++;
-
- /*
- * In order to save one allocation and an extra free, let's optimize
- * the allocation here: we'll use the first elements of the
- * dev->query_dv_timings_qmenu to store the timing strings pointer,
- * adding an extra space there to a store a string up to 32 bytes.
- * So, instead of allocating an array with size of:
- * dev->query_dv_timings_size * (sizeof(void *)
- * it will allocate:
- * dev->query_dv_timings_size * (sizeof(void *) +
- * dev->query_dv_timings_size * 32
- */
dev->query_dv_timings_qmenu = kmalloc_array(dev->query_dv_timings_size,
(sizeof(void *) + 32),
GFP_KERNEL);
if (dev->query_dv_timings_qmenu == NULL)
goto free_dev;
-
- /* Sets strings_base to be after the space to store the pointers */
- strings_base = ((char *)&dev->query_dv_timings_qmenu)
- + dev->query_dv_timings_size * sizeof(void *);
-
for (i = 0; i < dev->query_dv_timings_size; i++) {
const struct v4l2_bt_timings *bt = &v4l2_dv_timings_presets[i].bt;
- char *p = strings_base + i * 32;
+ char *p = (char *)&dev->query_dv_timings_qmenu[dev->query_dv_timings_size];
u32 htot, vtot;
+ p += i * 32;
dev->query_dv_timings_qmenu[i] = p;
htot = V4L2_DV_BT_FRAME_WIDTH(bt);