diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 0ebbe10d497a..9bb761eda59f 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -293,8 +293,10 @@ void drm_atomic_commit_default_clear(struct drm_atomic_commit *state) if (!connector) continue; - connector->funcs->atomic_destroy_state(connector, - state->connectors[i].state_to_destroy); + if (state->connectors[i].state_to_destroy) + connector->funcs->atomic_destroy_state(connector, + state->connectors[i].state_to_destroy); + state->connectors[i].ptr = NULL; state->connectors[i].state_to_destroy = NULL; state->connectors[i].old_state = NULL; @@ -308,8 +310,9 @@ void drm_atomic_commit_default_clear(struct drm_atomic_commit *state) if (!crtc) continue; - crtc->funcs->atomic_destroy_state(crtc, - state->crtcs[i].state_to_destroy); + if (state->crtcs[i].state_to_destroy) + crtc->funcs->atomic_destroy_state(crtc, + state->crtcs[i].state_to_destroy); state->crtcs[i].ptr = NULL; state->crtcs[i].state_to_destroy = NULL; @@ -328,8 +331,10 @@ void drm_atomic_commit_default_clear(struct drm_atomic_commit *state) if (!plane) continue; - plane->funcs->atomic_destroy_state(plane, - state->planes[i].state_to_destroy); + if (state->planes[i].state_to_destroy) + plane->funcs->atomic_destroy_state(plane, + state->planes[i].state_to_destroy); + state->planes[i].ptr = NULL; state->planes[i].state_to_destroy = NULL; state->planes[i].old_state = NULL; @@ -356,8 +361,10 @@ void drm_atomic_commit_default_clear(struct drm_atomic_commit *state) if (!obj) continue; - obj->funcs->atomic_destroy_state(obj, - state->private_objs[i].state_to_destroy); + if (state->private_objs[i].state_to_destroy) + obj->funcs->atomic_destroy_state(obj, + state->private_objs[i].state_to_destroy); + state->private_objs[i].ptr = NULL; state->private_objs[i].state_to_destroy = NULL; state->private_objs[i].old_state = NULL;