From 56cb5cf34e8edbf863ff5577efe851852472e9bd Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 8 Dec 2020 22:32:16 -0800 Subject: [PATCH] intel/genxml: Avoid generating identical 12.5 and 12 branches. Fix defects reported by Coverity Scan. Identical code for different branches (IDENTICAL_BRANCHES) identical_branches: The same code is executed regardless of whether 0 is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced? Signed-off-by: Vinson Lee Reviewed-by: Caio Marcelo de Oliveira Filho Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/genxml/gen_bits_header.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/intel/genxml/gen_bits_header.py b/src/intel/genxml/gen_bits_header.py index f1a625add18..95443dc1ff7 100644 --- a/src/intel/genxml/gen_bits_header.py +++ b/src/intel/genxml/gen_bits_header.py @@ -81,11 +81,15 @@ ${item.token_name}_${prop}(const struct gen_device_info *devinfo) { switch (devinfo->gen) { case 12: +%if item.get_prop(prop, 12.5) == item.get_prop(prop, 12): + return ${item.get_prop(prop, 12)}; +%else: if (gen_device_info_is_12hp(devinfo)) { return ${item.get_prop(prop, 12.5)}; } else { return ${item.get_prop(prop, 12)}; } +%endif case 11: return ${item.get_prop(prop, 11)}; case 9: return ${item.get_prop(prop, 9)}; case 8: return ${item.get_prop(prop, 8)};