scripts: extract_dts_includes: use deepcopcy when accessing reduced
Variables 'names' is copying value from 'reduced' dict and gives illusion that any computation could be done on copied data. Problem is that later computation on 'names' will modify data in 'reduced'. Use deepcopy in order to avoid erasing thing in reduced. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
parent
8e7403504a
commit
69a211fe00
1 changed files with 11 additions and 5 deletions
|
@ -15,6 +15,7 @@ import re
|
|||
import yaml
|
||||
import argparse
|
||||
import collections
|
||||
from copy import deepcopy
|
||||
|
||||
from devicetree import parse_file
|
||||
from extract.globals import *
|
||||
|
@ -439,12 +440,17 @@ def extract_node_include_info(reduced, root_node_address, sub_node_address,
|
|||
if re.match(k + '$', c):
|
||||
|
||||
if 'pinctrl-' in c:
|
||||
names = node['props'].get('pinctrl-names', [])
|
||||
names = deepcopy(node['props'].get(
|
||||
'pinctrl-names', []))
|
||||
else:
|
||||
names = node['props'].get(c[:-1] + '-names', [])
|
||||
if not names:
|
||||
names = node['props'].get(c + '-names', [])
|
||||
|
||||
if not c.endswith("-names"):
|
||||
names = deepcopy(node['props'].get(
|
||||
c[:-1] + '-names', []))
|
||||
if not names:
|
||||
names = deepcopy(node['props'].get(
|
||||
c + '-names', []))
|
||||
else:
|
||||
names = []
|
||||
if not isinstance(names, list):
|
||||
names = [names]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue