Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58a2ab3a authored by Dan Carpenter's avatar Dan Carpenter Committed by Boris Brezillon
Browse files

drm: atmel-hlcdc: fix a NULL check



If kmalloc() returned NULL we would end up dereferencing "state" a
couple lines later.

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
parent c2e4c994
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -414,7 +414,8 @@ atmel_hlcdc_crtc_duplicate_state(struct drm_crtc *crtc)
		return NULL;
		return NULL;


	state = kmalloc(sizeof(*state), GFP_KERNEL);
	state = kmalloc(sizeof(*state), GFP_KERNEL);
	if (state)
	if (!state)
		return NULL;
	__drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);
	__drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);


	cur = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state);
	cur = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state);