Commit 4067f4fa authored by Alex Hung's avatar Alex Hung Committed by Alex Deucher

drm/amd/display: Initialize get_bytes_per_element's default to 1

Variables, used as denominators and maybe not assigned to other values,
should not be 0. bytes_per_element_y & bytes_per_element_c are
initialized by get_bytes_per_element() which should never return 0.

This fixes 10 DIVIDE_BY_ZERO issues reported by Coverity.
Signed-off-by: default avatarAlex Hung <alex.hung@amd.com>
Reviewed-by: default avatarAurabindo Pillai <aurabindo.pillai@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarRodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 6eb1fe53
...@@ -78,7 +78,7 @@ static void calculate_ttu_cursor(struct display_mode_lib *mode_lib, ...@@ -78,7 +78,7 @@ static void calculate_ttu_cursor(struct display_mode_lib *mode_lib,
static unsigned int get_bytes_per_element(enum source_format_class source_format, bool is_chroma) static unsigned int get_bytes_per_element(enum source_format_class source_format, bool is_chroma)
{ {
unsigned int ret_val = 0; unsigned int ret_val = 1;
if (source_format == dm_444_16) { if (source_format == dm_444_16) {
if (!is_chroma) if (!is_chroma)
......
...@@ -53,7 +53,7 @@ static void calculate_ttu_cursor( ...@@ -53,7 +53,7 @@ static void calculate_ttu_cursor(
static unsigned int get_bytes_per_element(enum source_format_class source_format, bool is_chroma) static unsigned int get_bytes_per_element(enum source_format_class source_format, bool is_chroma)
{ {
unsigned int ret_val = 0; unsigned int ret_val = 1;
if (source_format == dm_444_16) { if (source_format == dm_444_16) {
if (!is_chroma) if (!is_chroma)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment