Let's add a check for src_sd before using it. The link may not be set, in which case the call to this function will fail. Signed-off-by: Alexander Shiyan <eagle.alexander923@xxxxxxxxx> --- drivers/media/platform/nxp/imx-mipi-csis.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c index 5f93712bf485..df5a159b2d39 100644 --- a/drivers/media/platform/nxp/imx-mipi-csis.c +++ b/drivers/media/platform/nxp/imx-mipi-csis.c @@ -595,6 +595,9 @@ static int mipi_csis_calculate_params(struct mipi_csis_device *csis, s64 link_freq; u32 lane_rate; + if (!csis->src_sd) + return -EINVAL; + /* Calculate the line rate from the pixel rate. */ link_freq = v4l2_get_link_freq(csis->src_sd->ctrl_handler, csis_fmt->width, -- 2.39.1