summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2013-11-26 09:42:47 +0100
committerStefan Agner <stefan.agner@toradex.com>2013-11-26 09:42:47 +0100
commitc1ac904677dad4383182331ee5f11cf006a0b8de (patch)
treedf662b35e6bee277507417233a8edab8e57baab7 /drivers
parentc7c52865252fc2106134cc50ce4823ef78d7e10e (diff)
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.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/tegra/dc/hdmi.c3
1 files changed, 3 insertions, 0 deletions
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);