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>
This commit is contained in:
parent
9334ef755f
commit
ede3ff5204
|
@ -497,14 +497,17 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
|
||||||
|
|
||||||
crtc_funcs = set->crtc->helper_private;
|
crtc_funcs = set->crtc->helper_private;
|
||||||
|
|
||||||
|
if (!set->mode)
|
||||||
|
set->fb = NULL;
|
||||||
|
|
||||||
if (set->fb) {
|
if (set->fb) {
|
||||||
DRM_DEBUG_KMS("[CRTC:%d] [FB:%d] #connectors=%d (x y) (%i %i)\n",
|
DRM_DEBUG_KMS("[CRTC:%d] [FB:%d] #connectors=%d (x y) (%i %i)\n",
|
||||||
set->crtc->base.id, set->fb->base.id,
|
set->crtc->base.id, set->fb->base.id,
|
||||||
(int)set->num_connectors, set->x, set->y);
|
(int)set->num_connectors, set->x, set->y);
|
||||||
} else {
|
} else {
|
||||||
DRM_DEBUG_KMS("[CRTC:%d] [NOFB] #connectors=%d (x y) (%i %i)\n",
|
DRM_DEBUG_KMS("[CRTC:%d] [NOFB]\n", set->crtc->base.id);
|
||||||
set->crtc->base.id, (int)set->num_connectors,
|
set->mode = NULL;
|
||||||
set->x, set->y);
|
set->num_connectors = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev = set->crtc->dev;
|
dev = set->crtc->dev;
|
||||||
|
|
Loading…
Reference in New Issue