@@ -35,15 +35,6 @@ static bool plane_enabled(struct drm_plane_state *state)
35
35
return state -> visible ;
36
36
}
37
37
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
-
47
38
/* helper to install properties which are common to planes and crtcs */
48
39
static void mdp5_plane_install_properties (struct drm_plane * plane ,
49
40
struct drm_mode_object * obj )
@@ -135,7 +126,6 @@ static void mdp5_plane_destroy_state(struct drm_plane *plane,
135
126
static const struct drm_plane_funcs mdp5_plane_funcs = {
136
127
.update_plane = drm_atomic_helper_update_plane ,
137
128
.disable_plane = drm_atomic_helper_disable_plane ,
138
- .destroy = mdp5_plane_destroy ,
139
129
.reset = mdp5_plane_reset ,
140
130
.atomic_duplicate_state = mdp5_plane_duplicate_state ,
141
131
.atomic_destroy_state = mdp5_plane_destroy_state ,
@@ -1037,33 +1027,21 @@ struct drm_plane *mdp5_plane_init(struct drm_device *dev,
1037
1027
{
1038
1028
struct drm_plane * plane = NULL ;
1039
1029
struct mdp5_plane * mdp5_plane ;
1040
- int ret ;
1041
1030
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 );
1047
1037
1048
1038
plane = & mdp5_plane -> base ;
1049
1039
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
-
1056
1040
drm_plane_helper_add (plane , & mdp5_plane_helper_funcs );
1057
1041
1058
1042
mdp5_plane_install_properties (plane , & plane -> base );
1059
1043
1060
1044
drm_plane_enable_fb_damage_clips (plane );
1061
1045
1062
1046
return plane ;
1063
-
1064
- fail :
1065
- if (plane )
1066
- mdp5_plane_destroy (plane );
1067
-
1068
- return ERR_PTR (ret );
1069
1047
}
0 commit comments