media: imx-mipi-csis: Check csis_fmt validity before use

The find_csis_format() may return NULL in case supported format is not
found, check the return value of find_csis_format() before using the
result to avoid NULL pointer dereference.

Fixes: 11927d0fd0 ("media: imx-mipi-csis: Use V4L2 subdev active state")
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
Marek Vasut 2023-02-16 02:44:01 +01:00 committed by Mauro Carvalho Chehab
parent 68e87ebf26
commit 3e62aba828
1 changed files with 3 additions and 0 deletions

View File

@ -1109,6 +1109,9 @@ static int mipi_csis_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
csis_fmt = find_csis_format(fmt->code);
v4l2_subdev_unlock_state(state);
if (!csis_fmt)
return -EPIPE;
fd->type = V4L2_MBUS_FRAME_DESC_TYPE_PARALLEL;
fd->num_entries = 1;