[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210716191733.2976039-1-trix@redhat.com>
Date: Fri, 16 Jul 2021 12:17:33 -0700
From: trix@...hat.com
To: bparrot@...com, mchehab@...nel.org,
tomi.valkeinen@...asonboard.com, hverkuil-cisco@...all.nl,
laurent.pinchart@...asonboard.com
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Tom Rix <trix@...hat.com>
Subject: [PATCH] media: ti-vpe: cal: fix indexing of cal->ctx[] in cal_probe()
From: Tom Rix <trix@...hat.com>
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@...hat.com>
---
drivers/media/platform/ti-vpe/cal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c
index 05bdc6d126d82..8e469d518a742 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -1148,9 +1148,9 @@ static int cal_probe(struct platform_device *pdev)
if (!cal->phy[i]->source_node)
continue;
- cal->ctx[i] = cal_ctx_create(cal, i);
- if (!cal->ctx[i]) {
- cal_err(cal, "Failed to create context %u\n", i);
+ cal->ctx[cal->num_contexts] = cal_ctx_create(cal, i);
+ if (!cal->ctx[cal->num_contexts]) {
+ cal_err(cal, "Failed to create context %u\n", cal->num_contexts);
ret = -ENODEV;
goto error_context;
}
--
2.26.3
Powered by blists - more mailing lists