From: Harry Wentland Date: Wed, 25 Nov 2015 20:42:09 +0000 (-0500) Subject: drm/amdgpu: Don't crash system if we can't get crtc X-Git-Tag: next-20160301~70^2~4^2~46 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9ddf940f5d73ca4a0ee1e8f65993f7f080f1ed20;p=karo-tx-linux.git drm/amdgpu: Don't crash system if we can't get crtc Signed-off-by: Harry Wentland Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index e23843f4d877..56f771e6dfa5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -727,6 +727,12 @@ int amdgpu_get_vblank_timestamp_kms(struct drm_device *dev, unsigned int pipe, /* Get associated drm_crtc: */ crtc = &adev->mode_info.crtcs[pipe]->base; + if (!crtc) { + /* This can occur on driver load if some component fails to + * initialize completely and driver is unloaded */ + DRM_ERROR("Uninitialized crtc %d\n", pipe); + return -EINVAL; + } /* Helper routine in DRM core does all the work: */ return drm_calc_vbltimestamp_from_scanoutpos(dev, pipe, max_error,