Commit ed6adfb7 authored by Jason-JH.Lin's avatar Jason-JH.Lin Committed by Chun-Kuang Hu
Browse files

drm/mediatek: Fix dereference before null check



Null-checking state suggests that it may be null, but it has already
been dereferenced on drm_atomic_get_new_plane_state(state, plane).

The parameter state will never be NULL currently, so just remove the
state is NULL flow in this function.

Fixes: 5ddb0bd4 ("drm/atomic: Pass the full state to planes async atomic check and update")
Signed-off-by: default avatarJason-JH.Lin <jason-jh.lin@mediatek.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: default avatarCK Hu <ck.hu@mediatek.com>
Reviewed-by: default avatarAlexandre Mergnat <amergnat@baylibre.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230714094908.13087-5-jason-jh.lin@mediatek.com/


Signed-off-by: default avatarChun-Kuang Hu <chunkuang.hu@kernel.org>
parent d761b945
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -122,11 +122,7 @@ static int mtk_plane_atomic_async_check(struct drm_plane *plane,
	if (ret)
		return ret;

	if (state)
		crtc_state = drm_atomic_get_existing_crtc_state(state,
								new_plane_state->crtc);
	else /* Special case for asynchronous cursor updates. */
		crtc_state = new_plane_state->crtc->state;
	crtc_state = drm_atomic_get_existing_crtc_state(state, new_plane_state->crtc);

	return drm_atomic_helper_check_plane_state(plane->state, crtc_state,
						   DRM_PLANE_NO_SCALING,