Merge tag 'drm-atmel-hlcdc-fixes/for-4.7-rc2' of github.com:bbrezillon/linux-at91 into drm-fixes

Two trivial bugfixes for the atmel-hlcdc driver.

The first one is making use of __drm_atomic_helper_crtc_destroy_state()
instead of duplicating its logic in atmel_hlcdc_crtc_reset() and
risking memory leaks if other objects are added to the common CRTC
state.

The second one is fixing a possible NULL pointer dereference.

* tag 'drm-atmel-hlcdc-fixes/for-4.7-rc2' of github.com:bbrezillon/linux-at91:
drm: atmel-hlcdc: fix a NULL check
drm: atmel-hlcdc: fix atmel_hlcdc_crtc_reset() implementation

Changed files
+5 -5
drivers
gpu
drm
atmel-hlcdc
+5 -5
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
··· 391 { 392 struct atmel_hlcdc_crtc_state *state; 393 394 - if (crtc->state && crtc->state->mode_blob) 395 - drm_property_unreference_blob(crtc->state->mode_blob); 396 - 397 if (crtc->state) { 398 state = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state); 399 kfree(state); 400 } 401 402 state = kzalloc(sizeof(*state), GFP_KERNEL); ··· 414 return NULL; 415 416 state = kmalloc(sizeof(*state), GFP_KERNEL); 417 - if (state) 418 - __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); 419 420 cur = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state); 421 state->output_mode = cur->output_mode;
··· 391 { 392 struct atmel_hlcdc_crtc_state *state; 393 394 if (crtc->state) { 395 + __drm_atomic_helper_crtc_destroy_state(crtc->state); 396 state = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state); 397 kfree(state); 398 + crtc->state = NULL; 399 } 400 401 state = kzalloc(sizeof(*state), GFP_KERNEL); ··· 415 return NULL; 416 417 state = kmalloc(sizeof(*state), GFP_KERNEL); 418 + if (!state) 419 + return NULL; 420 + __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); 421 422 cur = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state); 423 state->output_mode = cur->output_mode;