diff mbox series

[6/8] Critical KlockWork Error - Fixes - intel_tv.c - Possible NullPointerDereference1

Message ID 20200814024950.26830-6-nischal.varide@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/8] Critical KlockWork Error - Fixes - intel_cdclk.c - Possible NullPointerDereference1 | expand

Commit Message

Nischal Varide Aug. 14, 2020, 2:49 a.m. UTC
---
 drivers/gpu/drm/i915/display/intel_tv.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_tv.c b/drivers/gpu/drm/i915/display/intel_tv.c
index 777032d9697b..862ea94ffdae 100644
--- a/drivers/gpu/drm/i915/display/intel_tv.c
+++ b/drivers/gpu/drm/i915/display/intel_tv.c
@@ -1842,14 +1842,17 @@  static int intel_tv_atomic_check(struct drm_connector *connector,
 	old_state = drm_atomic_get_old_connector_state(state, connector);
 	new_crtc_state = drm_atomic_get_new_crtc_state(state, new_state->crtc);
 
-	if (old_state->tv.mode != new_state->tv.mode ||
-	    old_state->tv.margins.left != new_state->tv.margins.left ||
-	    old_state->tv.margins.right != new_state->tv.margins.right ||
-	    old_state->tv.margins.top != new_state->tv.margins.top ||
-	    old_state->tv.margins.bottom != new_state->tv.margins.bottom) {
+	if (old_state && new_state && new_crtc_state) {
+
+	    if (old_state->tv.mode != new_state->tv.mode ||
+		    old_state->tv.margins.left != new_state->tv.margins.left ||
+		    old_state->tv.margins.right != new_state->tv.margins.right ||
+		    old_state->tv.margins.top != new_state->tv.margins.top ||
+		    old_state->tv.margins.bottom != new_state->tv.margins.bottom) {
 		/* Force a modeset. */
 
 		new_crtc_state->connectors_changed = true;
+	    }
 	}
 
 	return 0;