Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4192089 authored by Maxime Ripard's avatar Maxime Ripard
Browse files

drm/sun4i: tv: Check mode pointer



The drm_mode_create call might return NULL in case of a failure, and the
current code doesn't check for that. Make sure it does.

Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
parent c222f399
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -507,9 +507,15 @@ static int sun4i_tv_comp_get_modes(struct drm_connector *connector)
	int i;

	for (i = 0; i < ARRAY_SIZE(tv_modes); i++) {
		struct drm_display_mode *mode = drm_mode_create(connector->dev);
		struct drm_display_mode *mode;
		const struct tv_mode *tv_mode = &tv_modes[i];

		mode = drm_mode_create(connector->dev);
		if (!mode) {
			DRM_ERROR("Failed to create a new display mode\n");
			return 0;
		}

		strcpy(mode->name, tv_mode->name);

		sun4i_tv_mode_to_drm_mode(tv_mode, mode);