vi: Add check for csi_port

Validate csi_port already in the setup phase to have same
behaviour as in the QNX.

Bug 5048625

Change-Id: Id53faa8c97899fe590da9b2e90dc72cac9e1b4ae
Signed-off-by: Jukka Kaartinen <jkaartinen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3315532
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mohit Ingale <mohiti@nvidia.com>
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
This commit is contained in:
Jukka Kaartinen
2025-03-07 10:42:06 +00:00
committed by Jon Hunter
parent a45f684085
commit 9e6481e659

View File

@@ -105,6 +105,11 @@
*/
#define MAX_VIRTUAL_CHANNEL_PER_STREAM U32_C(16)
/**
* @brief Maximum number of NVCSI ports supported.
*/
#define MAX_NVCSI_PORT_IDS U32_C(0x8)
/**
* @brief A 2-D array for storing all possible tegra_vi_channel struct pointers.
*/
@@ -675,6 +680,13 @@ int vi_capture_setup(
return -EINVAL;
}
#ifndef NV_IS_L4T
if (setup->csi_port >= MAX_NVCSI_PORT_IDS) {
dev_err(dev, "Invalid csi port\n");
return -EINVAL;
}
#endif
info = platform_get_drvdata(chan->vi_capture_pdev);
vi_inst = info->vi_instance_table[setup->csi_stream_id];