OSDN Git Service

media: ti-vpe: cal: fix indexing of cal->ctx[] in cal_probe()
authorTom Rix <trix@redhat.com>
Fri, 16 Jul 2021 19:17:33 +0000 (21:17 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 22 Jul 2021 12:01:55 +0000 (14:01 +0200)
commitfa0b5658597f1362c08c662a3a3c5139829e13a8
tree9bdf4f302e545d28431aafe1a7ecb2ff9f6a9a66
parente58430e1d4fd01b74475d2fbe2e25b5817b729a9
media: ti-vpe: cal: fix indexing of cal->ctx[] in cal_probe()

cal->ctx[i] is allocated with this loop
for (i = 0; i < cal->data->num_csi2_phy; ++i) {
and accessed in the error handler and else where with this loop
for (i = 0; i < cal->num_contexts; i++)
Because the first loop contains a continue statement
before cal->num_contexts is incremented, using i as the
indexer will leave gaps in the cal->ctx[].

So use cal->num_contexts as the indexer.

Fixes: 75e7e58bfac1 ("media: ti-vpe: cal: support 8 DMA contexts")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/ti-vpe/cal.c