intel/genxml: don't generate identical code for different branches

Quiets 16 Coverity warnings like:

CID 1403401: Identical code for different branches (IDENTICAL_BRANCHES)

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7351>
This commit is contained in:
Marcin Ślusarz 2020-10-28 17:39:57 +01:00 committed by Marge Bot
parent e96f33cd30
commit daec83c7d6
1 changed files with 8 additions and 0 deletions

View File

@ -86,19 +86,27 @@ ${item.token_name}_${prop}(const struct gen_device_info *devinfo)
case 9: return ${item.get_prop(prop, 9)};
case 8: return ${item.get_prop(prop, 8)};
case 7:
%if item.get_prop(prop, 7.5) == item.get_prop(prop, 7):
return ${item.get_prop(prop, 7)};
%else:
if (devinfo->is_haswell) {
return ${item.get_prop(prop, 7.5)};
} else {
return ${item.get_prop(prop, 7)};
}
%endif
case 6: return ${item.get_prop(prop, 6)};
case 5: return ${item.get_prop(prop, 5)};
case 4:
%if item.get_prop(prop, 4.5) == item.get_prop(prop, 4):
return ${item.get_prop(prop, 4)};
%else:
if (devinfo->is_g4x) {
return ${item.get_prop(prop, 4.5)};
} else {
return ${item.get_prop(prop, 4)};
}
%endif
default:
unreachable("Invalid hardware generation");
}