Skip to content

Commit

Permalink
drm/msm/mdp5: Add check for kzalloc
Browse files Browse the repository at this point in the history
As kzalloc may fail and return NULL pointer,
it should be better to check the return value
in order to avoid the NULL pointer dereference.

Fixes: 1cff744 ("drm/msm: Convert to using __drm_atomic_helper_crtc_reset() for reset.")
Signed-off-by: Jiasheng Jiang <[email protected]>
Reviewed-by: Dmitry Baryshkov <[email protected]>
Patchwork: https://patchwork.freedesktop.org/patch/514154/
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dmitry Baryshkov <[email protected]>
  • Loading branch information
JiangJias authored and lumag committed Jan 24, 2023
1 parent 93340e1 commit 13fcfcb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,10 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc)
if (crtc->state)
mdp5_crtc_destroy_state(crtc, crtc->state);

__drm_atomic_helper_crtc_reset(crtc, &mdp5_cstate->base);
if (mdp5_cstate)
__drm_atomic_helper_crtc_reset(crtc, &mdp5_cstate->base);
else
__drm_atomic_helper_crtc_reset(crtc, NULL);
}

static const struct drm_crtc_funcs mdp5_crtc_no_lm_cursor_funcs = {
Expand Down

0 comments on commit 13fcfcb

Please sign in to comment.