drm: Catch stop possible NULL pointer reference
This was caught by Weiss. Also added some comments to the fb_changed and mode_changed variables to explain what they do. Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Tested-by: Thomas White <taw@bitwiz.org.uk> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
7781de7456
commit
4cb72b1727
|
@ -706,8 +706,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
|
||||||
struct drm_encoder **save_encoders, *new_encoder;
|
struct drm_encoder **save_encoders, *new_encoder;
|
||||||
struct drm_framebuffer *old_fb = NULL;
|
struct drm_framebuffer *old_fb = NULL;
|
||||||
bool save_enabled;
|
bool save_enabled;
|
||||||
bool mode_changed = false;
|
bool mode_changed = false; /* if true do a full mode set */
|
||||||
bool fb_changed = false;
|
bool fb_changed = false; /* if true and !mode_changed just do a flip */
|
||||||
struct drm_connector *connector;
|
struct drm_connector *connector;
|
||||||
int count = 0, ro, fail = 0;
|
int count = 0, ro, fail = 0;
|
||||||
struct drm_crtc_helper_funcs *crtc_funcs;
|
struct drm_crtc_helper_funcs *crtc_funcs;
|
||||||
|
@ -758,6 +758,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
|
||||||
if (set->crtc->fb == NULL) {
|
if (set->crtc->fb == NULL) {
|
||||||
DRM_DEBUG("crtc has no fb, full mode set\n");
|
DRM_DEBUG("crtc has no fb, full mode set\n");
|
||||||
mode_changed = true;
|
mode_changed = true;
|
||||||
|
} else if (set->fb == NULL) {
|
||||||
|
mode_changed = true;
|
||||||
} else if ((set->fb->bits_per_pixel !=
|
} else if ((set->fb->bits_per_pixel !=
|
||||||
set->crtc->fb->bits_per_pixel) ||
|
set->crtc->fb->bits_per_pixel) ||
|
||||||
set->fb->depth != set->crtc->fb->depth)
|
set->fb->depth != set->crtc->fb->depth)
|
||||||
|
|
Loading…
Reference in New Issue