[Intel-gfx] [PATCH 1/4] drm/fb-helper: Do not assume drm_mode_create_from_cmdline_mode() can't fail

Ville Syrjala ville.syrjala at linux.intel.com
Fri Jun 7 16:26:08 UTC 2019


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

drm_mode_create_from_cmdline_mode() can return NULL, so the caller
should check for that.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/drm_fb_helper.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index b9b7c06cbc4f..bdfa14cd7f6d 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -2205,7 +2205,9 @@ struct drm_display_mode *drm_pick_cmdline_mode(struct drm_fb_helper_connector *f
 create_mode:
 	mode = drm_mode_create_from_cmdline_mode(fb_helper_conn->connector->dev,
 						 cmdline_mode);
-	list_add(&mode->head, &fb_helper_conn->connector->modes);
+	if (mode)
+		list_add(&mode->head, &fb_helper_conn->connector->modes);
+
 	return mode;
 }
 EXPORT_SYMBOL(drm_pick_cmdline_mode);
-- 
2.21.0



More information about the Intel-gfx mailing list