summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-07-06 20:36:03 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-07-19 09:25:32 +0200
commit2f63379b93fa389ed65432d456da6697f60f7338 (patch)
tree091de9438a53cb392a5c03165cc0385c512ddaa5 /drivers/media
parented595da7d70fbb12bb5bd30936b472164082c484 (diff)
media: ti-vpe: cal: Use a loop to create CAMERARX and context instances
Replace a manually unrolled loop with an explicit for loop to increase readability when creating the CAMERARX and context instances. The explicit NULL initialization of cal->phy[] and cal->ctx[] is removed, as the cal structure is zeroed when allocated. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Reviewed-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/ti-vpe/cal.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c
index b55c8fb369a0..f92d6e49571f 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -2348,24 +2348,15 @@ static int cal_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, cal);
- cal->phy[0] = cal_camerarx_create(cal, 0);
- if (IS_ERR(cal->phy[0]))
- return PTR_ERR(cal->phy[0]);
-
- if (cal->data->num_csi2_phy > 1) {
- cal->phy[1] = cal_camerarx_create(cal, 1);
- if (IS_ERR(cal->phy[1]))
- return PTR_ERR(cal->phy[1]);
- } else {
- cal->phy[1] = NULL;
+ for (i = 0; i < cal->data->num_csi2_phy; ++i) {
+ cal->phy[i] = cal_camerarx_create(cal, i);
+ if (IS_ERR(cal->phy[i]))
+ return PTR_ERR(cal->phy[i]);
}
- cal->ctx[0] = NULL;
- cal->ctx[1] = NULL;
+ for (i = 0; i < cal->data->num_csi2_phy; ++i)
+ cal->ctx[i] = cal_create_instance(cal, i);
- cal->ctx[0] = cal_create_instance(cal, 0);
- if (cal->data->num_csi2_phy > 1)
- cal->ctx[1] = cal_create_instance(cal, 1);
if (!cal->ctx[0] && !cal->ctx[1]) {
cal_err(cal, "Neither port is configured, no point in staying up\n");
return -ENODEV;