From: Ville Syrjälä Date: Tue, 1 Oct 2019 15:46:29 +0000 (+0300) Subject: drm/i915: Polish intel_tv_mode_valid() X-Git-Tag: v5.5-rc1~128^2~32^2~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=15de0889b0c905a64d6f0fbc765a25d7899a560b;p=thirdparty%2Fkernel%2Flinux.git drm/i915: Polish intel_tv_mode_valid() Drop the tv_mode NULL check since intel_tv_mode_find() never actually returns NULL, and flip the condition around so that the MODE_OK case is at the end, which is customary to all the other .mode_valid() implementations. Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20191001154629.11063-2-ville.syrjala@linux.intel.com Reviewed-by: José Roberto de Souza --- diff --git a/drivers/gpu/drm/i915/display/intel_tv.c b/drivers/gpu/drm/i915/display/intel_tv.c index b70221f5112a7..71c3f7e5df7d2 100644 --- a/drivers/gpu/drm/i915/display/intel_tv.c +++ b/drivers/gpu/drm/i915/display/intel_tv.c @@ -961,11 +961,10 @@ intel_tv_mode_valid(struct drm_connector *connector, return MODE_CLOCK_HIGH; /* Ensure TV refresh is close to desired refresh */ - if (tv_mode && abs(tv_mode->refresh - drm_mode_vrefresh(mode) * 1000) - < 1000) - return MODE_OK; + if (abs(tv_mode->refresh - drm_mode_vrefresh(mode) * 1000) >= 1000) + return MODE_CLOCK_RANGE; - return MODE_CLOCK_RANGE; + return MODE_OK; } static int