diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-01-31 06:16:33 -0500 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-01-31 07:36:33 -0500 |
commit | ede3ff5204b0117d00609f4980df3b864cefe96f (patch) | |
tree | dda9eb0628576ad239f1315d05e94359db1f4770 /drivers/gpu/drm/drm_crtc_helper.c | |
parent | 9334ef755f060e251f3f395caeda1a58b6834ea3 (diff) |
drm: Simplify and defend later checks when disabling a crtc
By setting the FB of a CRTC to NULL, we are turning off the CRTC (and so
disable the unused encoders and connectors). As such we can simplify the
later tests by making sure the set->mode is NULL. Setting the
num_connectors to zero means that we do not need to loop over the unused
connectors.
All current usage appears correct, this only builds additional defense
into the routine.
References: https://bugzilla.kernel.org/show_bug.cgi?id=27722
Tested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc_helper.c')
-rw-r--r-- | drivers/gpu/drm/drm_crtc_helper.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 468e8e16c806..c4178d7c6a08 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -497,14 +497,17 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
497 | 497 | ||
498 | crtc_funcs = set->crtc->helper_private; | 498 | crtc_funcs = set->crtc->helper_private; |
499 | 499 | ||
500 | if (!set->mode) | ||
501 | set->fb = NULL; | ||
502 | |||
500 | if (set->fb) { | 503 | if (set->fb) { |
501 | DRM_DEBUG_KMS("[CRTC:%d] [FB:%d] #connectors=%d (x y) (%i %i)\n", | 504 | DRM_DEBUG_KMS("[CRTC:%d] [FB:%d] #connectors=%d (x y) (%i %i)\n", |
502 | set->crtc->base.id, set->fb->base.id, | 505 | set->crtc->base.id, set->fb->base.id, |
503 | (int)set->num_connectors, set->x, set->y); | 506 | (int)set->num_connectors, set->x, set->y); |
504 | } else { | 507 | } else { |
505 | DRM_DEBUG_KMS("[CRTC:%d] [NOFB] #connectors=%d (x y) (%i %i)\n", | 508 | DRM_DEBUG_KMS("[CRTC:%d] [NOFB]\n", set->crtc->base.id); |
506 | set->crtc->base.id, (int)set->num_connectors, | 509 | set->mode = NULL; |
507 | set->x, set->y); | 510 | set->num_connectors = 0; |
508 | } | 511 | } |
509 | 512 | ||
510 | dev = set->crtc->dev; | 513 | dev = set->crtc->dev; |