diff mbox series

media: platform: nxp: fix return value check in mipi_csis_s_stream()

Message ID KL1PR06MB617883F6696C3A07B5B5CEB5E0452@KL1PR06MB6178.apcprd06.prod.outlook.com
State New
Headers show
Series media: platform: nxp: fix return value check in mipi_csis_s_stream() | expand

Commit Message

Andy Chen Feb. 7, 2024, 3:36 p.m. UTC
Hi,

find_csis_format() may return NULL, and we should determine its return value
to prevent a fatal error when later functions use it.


This is my first patch, any suggestions are welcome, thanks!

Regards,

Andy Chen
diff mbox series

Patch

diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
index db8ff5f5c4d3..ac867620e2ba 100644
--- a/drivers/media/platform/nxp/imx-mipi-csis.c
+++ b/drivers/media/platform/nxp/imx-mipi-csis.c
@@ -956,6 +956,8 @@  static int mipi_csis_s_stream(struct v4l2_subdev *sd, int enable)
 
 	format = v4l2_subdev_state_get_format(state, CSIS_PAD_SINK);
 	csis_fmt = find_csis_format(format->code);
+	if (!csis_fmt)
+		return -EPIPE;
 
 	ret = mipi_csis_calculate_params(csis, csis_fmt);
 	if (ret < 0)