]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm: WARN on illegal aspect ratio when converting a mode to umode
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 20 Jun 2019 14:26:37 +0000 (17:26 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 24 Jun 2019 15:08:55 +0000 (18:08 +0300)
WARN if the incoming drm_display_mode has an illegal aspect ratio
when converting it to a user mode. This should never happen unless
the driver made a mistake and put an invalid value into the aspect
ratio.

Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190620142639.17518-4-ville.syrjala@linux.intel.com
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/drm_modes.c

index 847048dee048e89a565e2dfaaf31801d69284ac3..be2ccd8eccfdee3d43742eb6db2518dcf4f0227d 100644 (file)
@@ -1906,8 +1906,11 @@ void drm_mode_convert_to_umode(struct drm_mode_modeinfo *out,
        case HDMI_PICTURE_ASPECT_256_135:
                out->flags |= DRM_MODE_FLAG_PIC_AR_256_135;
                break;
-       case HDMI_PICTURE_ASPECT_RESERVED:
        default:
+               WARN(1, "Invalid aspect ratio (0%x) on mode\n",
+                    in->picture_aspect_ratio);
+               /* fall through */
+       case HDMI_PICTURE_ASPECT_NONE:
                out->flags |= DRM_MODE_FLAG_PIC_AR_NONE;
                break;
        }