Skip to content

Commit 396786a

Browse files
l1kkuba-moo
authored andcommitted
tools: ynl-gen: Allow multi-attr without nested-attributes again
Since commit ce6cb81 ("tools: ynl-gen: individually free previous values on double set"), specifying the "multi-attr" property raises an error unless the "nested-attributes" property is specified as well: File "tools/net/ynl/./pyynl/ynl_gen_c.py", line 1147, in _load_nested_sets child = self.pure_nested_structs.get(nested) ^^^^^^ UnboundLocalError: cannot access local variable 'nested' where it is not associated with a value This appears to be a bug since there are existing specs which omit "nested-attributes" on "multi-attr" attributes. Also, according to Documentation/userspace-api/netlink/specs.rst, multi-attr "is the recommended way of implementing arrays (no extra nesting)", suggesting that nesting should even be avoided in favor of multi-attr. Fix the indentation of the if-block introduced by the commit to avoid the error. Fixes: ce6cb81 ("tools: ynl-gen: individually free previous values on double set") Signed-off-by: Lukas Wunner <[email protected]> Link: https://patch.msgid.link/d6b58684b7e5bfb628f7313e6893d0097904e1d1.1746940107.git.lukas@wunner.de Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4227ea9 commit 396786a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tools/net/ynl/pyynl/ynl_gen_c.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,10 +1143,9 @@ def _load_nested_sets(self):
11431143
self.pure_nested_structs[nested].request = True
11441144
if attr in rs_members['reply']:
11451145
self.pure_nested_structs[nested].reply = True
1146-
1147-
if spec.is_multi_val():
1148-
child = self.pure_nested_structs.get(nested)
1149-
child.in_multi_val = True
1146+
if spec.is_multi_val():
1147+
child = self.pure_nested_structs.get(nested)
1148+
child.in_multi_val = True
11501149

11511150
self._sort_pure_types()
11521151

0 commit comments

Comments
 (0)