From: Fabien DESSENNE Date: Thu, 12 Jan 2017 16:27:37 +0000 (+0100) Subject: drm/sti: do not check hw scaling if mode is not set X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=6801723b0187c0bb0803758b7b7ef14ba22fdcf2;p=openwrt%2Fstaging%2Fblogic.git drm/sti: do not check hw scaling if mode is not set Fix a division by 0 case : in some cases, when the HQVDP plane is being disabled atomic_check() is called with "mode->clock = 0". In that case, do not check for scaling capabilities. Signed-off-by: Fabien Dessenne Acked-by: Vincent Abriou --- diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c index 4376fd8a8e52..66f843148ef7 100644 --- a/drivers/gpu/drm/sti/sti_hqvdp.c +++ b/drivers/gpu/drm/sti/sti_hqvdp.c @@ -1037,9 +1037,9 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane, src_w = state->src_w >> 16; src_h = state->src_h >> 16; - if (!sti_hqvdp_check_hw_scaling(hqvdp, mode, - src_w, src_h, - dst_w, dst_h)) { + if (mode->clock && !sti_hqvdp_check_hw_scaling(hqvdp, mode, + src_w, src_h, + dst_w, dst_h)) { DRM_ERROR("Scaling beyond HW capabilities\n"); return -EINVAL; }