From c1ac904677dad4383182331ee5f11cf006a0b8de Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 26 Nov 2013 09:42:47 +0100 Subject: hdmi: avoid division by zero oops After suspend, mode filter might be called with empty yres. This leads to division by zero when checking aspect ratio. Return as invalid mode when yres is zero. --- drivers/video/tegra/dc/hdmi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/video/tegra/dc/hdmi.c b/drivers/video/tegra/dc/hdmi.c index a0aa27fc4114..ae45f04172aa 100644 --- a/drivers/video/tegra/dc/hdmi.c +++ b/drivers/video/tegra/dc/hdmi.c @@ -1258,6 +1258,9 @@ static bool tegra_dc_hdmi_valid_asp_ratio(const struct tegra_dc *dc, int m_aspratio = 0; int s_aspratio = 0; + if (!mode->yres) + return false; + /* To check the aspect upto two decimal digits, calculate in % */ m_aspratio = (mode->xres*100 / mode->yres); -- cgit v1.2.3