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

Commit 72e45e92 authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Dave Airlie
Browse files

drm: Preserve the list head in drm_mode_copy



Preserve the destination mode's list head in drm_mode_copy. Just
in case someone decides that it's a good idea to overwrite a mode which
happens to be on some list,

Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent f6fb754d
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -789,16 +789,17 @@ EXPORT_SYMBOL(drm_mode_set_crtcinfo);
 * LOCKING:
 * None.
 *
 * Copy an existing mode into another mode, preserving the object id
 * of the destination mode.
 * Copy an existing mode into another mode, preserving the object id and
 * list head of the destination mode.
 */
void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src)
{
	int id = dst->base.id;
	struct list_head head = dst->head;

	*dst = *src;
	dst->base.id = id;
	INIT_LIST_HEAD(&dst->head);
	dst->head = head;
}
EXPORT_SYMBOL(drm_mode_copy);