diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2013-05-31 08:17:06 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2013-06-10 18:34:23 -0400 |
commit | 72e45e9267bfbf299f2f4c14c8c923a4f6444030 (patch) | |
tree | a3f74ce4b851a3178b7e43cb8a43ffa208056863 /drivers/gpu/drm/drm_modes.c | |
parent | f6fb754dc6f1def4bdc28f9391d835860612b9b4 (diff) |
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: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_modes.c')
-rw-r--r-- | drivers/gpu/drm/drm_modes.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 09785422e654..69153385c63f 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c | |||
@@ -789,16 +789,17 @@ EXPORT_SYMBOL(drm_mode_set_crtcinfo); | |||
789 | * LOCKING: | 789 | * LOCKING: |
790 | * None. | 790 | * None. |
791 | * | 791 | * |
792 | * Copy an existing mode into another mode, preserving the object id | 792 | * Copy an existing mode into another mode, preserving the object id and |
793 | * of the destination mode. | 793 | * list head of the destination mode. |
794 | */ | 794 | */ |
795 | void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src) | 795 | void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src) |
796 | { | 796 | { |
797 | int id = dst->base.id; | 797 | int id = dst->base.id; |
798 | struct list_head head = dst->head; | ||
798 | 799 | ||
799 | *dst = *src; | 800 | *dst = *src; |
800 | dst->base.id = id; | 801 | dst->base.id = id; |
801 | INIT_LIST_HEAD(&dst->head); | 802 | dst->head = head; |
802 | } | 803 | } |
803 | EXPORT_SYMBOL(drm_mode_copy); | 804 | EXPORT_SYMBOL(drm_mode_copy); |
804 | 805 | ||