@@ -35,15 +35,6 @@ static bool plane_enabled(struct drm_plane_state *state)
3535 return state -> visible ;
3636}
3737
38- static void mdp5_plane_destroy (struct drm_plane * plane )
39- {
40- struct mdp5_plane * mdp5_plane = to_mdp5_plane (plane );
41-
42- drm_plane_cleanup (plane );
43-
44- kfree (mdp5_plane );
45- }
46-
4738/* helper to install properties which are common to planes and crtcs */
4839static void mdp5_plane_install_properties (struct drm_plane * plane ,
4940 struct drm_mode_object * obj )
@@ -135,7 +126,6 @@ static void mdp5_plane_destroy_state(struct drm_plane *plane,
135126static const struct drm_plane_funcs mdp5_plane_funcs = {
136127 .update_plane = drm_atomic_helper_update_plane ,
137128 .disable_plane = drm_atomic_helper_disable_plane ,
138- .destroy = mdp5_plane_destroy ,
139129 .reset = mdp5_plane_reset ,
140130 .atomic_duplicate_state = mdp5_plane_duplicate_state ,
141131 .atomic_destroy_state = mdp5_plane_destroy_state ,
@@ -1037,33 +1027,21 @@ struct drm_plane *mdp5_plane_init(struct drm_device *dev,
10371027{
10381028 struct drm_plane * plane = NULL ;
10391029 struct mdp5_plane * mdp5_plane ;
1040- int ret ;
10411030
1042- mdp5_plane = kzalloc (sizeof (* mdp5_plane ), GFP_KERNEL );
1043- if (!mdp5_plane ) {
1044- ret = - ENOMEM ;
1045- goto fail ;
1046- }
1031+ mdp5_plane = drmm_universal_plane_alloc (dev , struct mdp5_plane , base ,
1032+ 0xff , & mdp5_plane_funcs ,
1033+ mdp5_plane_formats , ARRAY_SIZE (mdp5_plane_formats ),
1034+ NULL , type , NULL );
1035+ if (IS_ERR (mdp5_plane ))
1036+ return ERR_CAST (mdp5_plane );
10471037
10481038 plane = & mdp5_plane -> base ;
10491039
1050- ret = drm_universal_plane_init (dev , plane , 0xff , & mdp5_plane_funcs ,
1051- mdp5_plane_formats , ARRAY_SIZE (mdp5_plane_formats ),
1052- NULL , type , NULL );
1053- if (ret )
1054- goto fail ;
1055-
10561040 drm_plane_helper_add (plane , & mdp5_plane_helper_funcs );
10571041
10581042 mdp5_plane_install_properties (plane , & plane -> base );
10591043
10601044 drm_plane_enable_fb_damage_clips (plane );
10611045
10621046 return plane ;
1063-
1064- fail :
1065- if (plane )
1066- mdp5_plane_destroy (plane );
1067-
1068- return ERR_PTR (ret );
10691047}
0 commit comments