Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/atmel-hlcdc: destroy properly the plane state in the reset callback

If there is a plane state to destroy when doing a plane reset, destroy
it using the atmel_hlcdc_plane_destroy_state() function. So we call
__drm_atomic_helper_plane_destroy_state() and avoid code duplication.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Reviewed-by: Manikandan Muralidharan <manikandan.m@microchip.com>
Link: https://patch.msgid.link/20251218-lcd_cleanup_mainline-v2-8-df837aba878f@microchip.com
Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>

authored by

Ludovic Desroches and committed by
Manikandan Muralidharan
81af99cb 4bad57c2

+26 -26
+26 -26
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
··· 1155 1155 return -ENOMEM; 1156 1156 } 1157 1157 1158 - static void atmel_hlcdc_plane_reset(struct drm_plane *p) 1159 - { 1160 - struct atmel_hlcdc_plane_state *state; 1161 - 1162 - if (p->state) { 1163 - state = drm_plane_state_to_atmel_hlcdc_plane_state(p->state); 1164 - 1165 - if (state->base.fb) 1166 - drm_framebuffer_put(state->base.fb); 1167 - 1168 - kfree(state); 1169 - p->state = NULL; 1170 - } 1171 - 1172 - state = kzalloc(sizeof(*state), GFP_KERNEL); 1173 - if (state) { 1174 - if (atmel_hlcdc_plane_alloc_dscrs(p, state)) { 1175 - kfree(state); 1176 - drm_err(p->dev, 1177 - "Failed to allocate initial plane state\n"); 1178 - return; 1179 - } 1180 - __drm_atomic_helper_plane_reset(p, &state->base); 1181 - } 1182 - } 1183 - 1184 1158 static struct drm_plane_state * 1185 1159 atmel_hlcdc_plane_atomic_duplicate_state(struct drm_plane *p) 1186 1160 { ··· 1194 1220 drm_framebuffer_put(s->fb); 1195 1221 1196 1222 kfree(state); 1223 + } 1224 + 1225 + static void atmel_hlcdc_plane_reset(struct drm_plane *p) 1226 + { 1227 + struct atmel_hlcdc_plane_state *state; 1228 + struct atmel_hlcdc_dc *dc = p->dev->dev_private; 1229 + struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p); 1230 + 1231 + if (p->state) { 1232 + atmel_hlcdc_plane_atomic_destroy_state(p, p->state); 1233 + p->state = NULL; 1234 + } 1235 + 1236 + state = kzalloc(sizeof(*state), GFP_KERNEL); 1237 + if (state) { 1238 + if (atmel_hlcdc_plane_alloc_dscrs(p, state)) { 1239 + kfree(state); 1240 + drm_err(p->dev, 1241 + "Failed to allocate initial plane state\n"); 1242 + return; 1243 + } 1244 + __drm_atomic_helper_plane_reset(p, &state->base); 1245 + } 1246 + 1247 + if (plane->layer.desc->layout.csc) 1248 + dc->desc->ops->lcdc_csc_init(plane, plane->layer.desc); 1197 1249 } 1198 1250 1199 1251 static const struct drm_plane_funcs layer_plane_funcs = {