drm: fixes crct set_mode when encoder mode_fixup is null.
authorCarlos Palminha <CARLOS.PALMINHA@synopsys.com>
Wed, 10 Feb 2016 12:15:22 +0000 (12:15 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 11 Feb 2016 08:23:54 +0000 (09:23 +0100)
Avoids null crash when encoders don't implement mode_fixup.

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
[danvet: Also update kerneldoc.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1455106522-32307-1-git-send-email-palminha@synopsys.com
drivers/gpu/drm/drm_crtc_helper.c
include/drm/drm_modeset_helper_vtables.h

index 9f8b894f44809fcaa7b01e34d489e2e34038d4e1..df6a12de208bc5f997f4a31eabd7224a5591098e 100644 (file)
@@ -337,10 +337,12 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
                }
 
                encoder_funcs = encoder->helper_private;
-               if (!(ret = encoder_funcs->mode_fixup(encoder, mode,
-                                                     adjusted_mode))) {
-                       DRM_DEBUG_KMS("Encoder fixup failed\n");
-                       goto done;
+               if (encoder_funcs->mode_fixup) {
+                       if (!(ret = encoder_funcs->mode_fixup(encoder, mode,
+                                                             adjusted_mode))) {
+                               DRM_DEBUG_KMS("Encoder fixup failed\n");
+                               goto done;
+                       }
                }
        }
 
index a126a0d7aed470c77e6551054d9a29057375115f..b61c2d45192e1f1e74618d4bb8c783fce756695f 100644 (file)
@@ -439,7 +439,7 @@ struct drm_encoder_helper_funcs {
         * can be modified by this callback and does not need to match mode.
         *
         * This function is used by both legacy CRTC helpers and atomic helpers.
-        * With atomic helpers it is optional.
+        * This hook is optional.
         *
         * NOTE:
         *