diff options
author | Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com> | 2023-07-25 13:16:41 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-07-26 23:38:23 +0300 |
commit | d7ddf5f4269fcaf19aafe971e635d91897423a3a (patch) | |
tree | 04fa5b7e6659265ddcde9b1fbafb7d94f4ec4b34 /tools | |
parent | d4a7ce642100765119a872d4aba1bf63e3a22c8a (diff) | |
download | linux-d7ddf5f4269fcaf19aafe971e635d91897423a3a.tar.xz |
tools: ynl-gen: fix enum index in _decode_enum(..)
Remove wrong index adjustment, which is leftover from adding
support for sparse enums.
enum.entries_by_val() function shall not subtract the start-value, as
it is indexed with real enum value.
Fixes: c311aaa74ca1 ("tools: ynl: fix enum-as-flags in the generic CLI")
Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Link: https://lore.kernel.org/r/20230725101642.267248-2-arkadiusz.kubalewski@intel.com
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/net/ynl/lib/ynl.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py index 1b3a36fbb1c3..027b1c0aecb4 100644 --- a/tools/net/ynl/lib/ynl.py +++ b/tools/net/ynl/lib/ynl.py @@ -420,8 +420,8 @@ class YnlFamily(SpecFamily): def _decode_enum(self, rsp, attr_spec): raw = rsp[attr_spec['name']] enum = self.consts[attr_spec['enum']] - i = attr_spec.get('value-start', 0) if 'enum-as-flags' in attr_spec and attr_spec['enum-as-flags']: + i = 0 value = set() while raw: if raw & 1: @@ -429,7 +429,7 @@ class YnlFamily(SpecFamily): raw >>= 1 i += 1 else: - value = enum.entries_by_val[raw - i].name + value = enum.entries_by_val[raw].name rsp[attr_spec['name']] = value def _decode_binary(self, attr, attr_spec): |