camera: channel: Make sure csi channels are initailized before access

There is case where CSI channels are initialized later before
accessing it. In this case, it can cause NULL pointer access.

Add checks before accessing it in the function
tegra_channel_find_linked_csi_subdev().

Bug 4346767

Change-Id: I752898af4b2164540cbd2e071ee36af4cd5f6fde
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3039709
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-12-22 18:04:31 +00:00
committed by mobile promotions
parent b2dcbdbc93
commit 1729ced2bf

View File

@@ -2007,6 +2007,9 @@ struct v4l2_subdev *tegra_channel_find_linked_csi_subdev(
struct tegra_csi_channel *csi_it;
int i = 0;
if (!csi)
return NULL;
list_for_each_entry(csi_it, &csi->csi_chans, list) {
for (i = 0; i < chan->num_subdevs; i++)
if (chan->subdev[i] == &csi_it->subdev)