diff mbox

[3/3] drm/sti: do not check hw scaling if mode is not set

Message ID 1484238457-4848-4-git-send-email-fabien.dessenne@st.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fabien DESSENNE Jan. 12, 2017, 4:27 p.m. UTC
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 <fabien.dessenne@st.com>
---
 drivers/gpu/drm/sti/sti_hqvdp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Vincent Abriou Feb. 1, 2017, 2:43 p.m. UTC | #1
Acked-by: Vincent Abriou <vincent.abriou@st.com>

On 01/12/2017 05:27 PM, Fabien Dessenne wrote:
> 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 <fabien.dessenne@st.com>
> ---
>  drivers/gpu/drm/sti/sti_hqvdp.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
> index f88130f..723ac30 100644
> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
> @@ -1035,9 +1035,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;
>  	}
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index f88130f..723ac30 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -1035,9 +1035,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;
 	}