[PATCH] drm: mxsfb: Check NULL pointer

Jiasheng Jiang jiasheng at iscas.ac.cn
Wed Nov 3 00:48:18 PDT 2021


As we see in the drm_connector_list_iter_next(), it could return
NULL. In order to avoid the use of the NULL pointer, it may be
better to check the return value.

Fixes: c42001e ("drm: mxsfb: Use drm_panel_bridge")
Signed-off-by: Jiasheng Jiang <jiasheng at iscas.ac.cn>
---
 drivers/gpu/drm/mxsfb/mxsfb_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index 6da9355..b875c11 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -145,6 +145,8 @@ static int mxsfb_attach_bridge(struct mxsfb_drm_private *mxsfb)
 	 */
 	drm_connector_list_iter_begin(drm, &iter);
 	mxsfb->connector = drm_connector_list_iter_next(&iter);
+	if (!mxsfb->connector)
+		return 1;
 	drm_connector_list_iter_end(&iter);
 
 	return 0;
-- 
2.7.4




More information about the linux-arm-kernel mailing list