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 <vlee@freedesktop.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8001>
This commit is contained in:
Vinson Lee 2020-12-08 22:32:16 -08:00 committed by Marge Bot
parent 73c3380335
commit 56cb5cf34e

View file

@ -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)};