Mesa (master): intel/genxml: Avoid generating identical 12.5 and 12 branches.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Dec 12 02:45:15 UTC 2020


Module: Mesa
Branch: master
Commit: 56cb5cf34e8edbf863ff5577efe851852472e9bd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=56cb5cf34e8edbf863ff5577efe851852472e9bd

Author: Vinson Lee <vlee at freedesktop.org>
Date:   Tue Dec  8 22:32:16 2020 -0800

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 at freedesktop.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8001>

---

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



More information about the mesa-commit mailing list