mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
drm/amd/display: Initialize get_bytes_per_element's default to 1
[ Upstream commit 4067f4fa0423a89fb19a30b57231b384d77d2610 ] 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: Alex Hung <alex.hung@amd.com> Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0f1e222a4b
commit
a23d6029e7
@@ -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(
|
|||||||
|
|
||||||
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user