[PATCH] hda-analyzer: Avoid AttributeError when codec has no nodes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When traversing card/codec/nodes during treewidget creation, it's quite
possible that codec.nodes raises an AttributeError if the current codec
doesn't seem to have a nodes dictionary.

Simply initialize it to an empty dictionary in the beginning of
analyze().

Signed-off-by: Ozan Çağlayan <ozan@xxxxxxxxxxxxx>
---
 hda-analyzer/hda_codec.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hda-analyzer/hda_codec.py b/hda-analyzer/hda_codec.py
index cbea3f8..d587a28 100644
--- a/hda-analyzer/hda_codec.py
+++ b/hda-analyzer/hda_codec.py
@@ -818,6 +818,7 @@ class HDACodec:
   def analyze(self):
     self.afg = None
     self.mfg = None
+    self.nodes = {}
     self.vendor_id = self.param_read(AC_NODE_ROOT, PARAMS['VENDOR_ID'])
     self.subsystem_id = self.param_read(AC_NODE_ROOT, PARAMS['SUBSYSTEM_ID'])
     self.revision_id = self.param_read(AC_NODE_ROOT, PARAMS['REV_ID'])
@@ -866,7 +867,6 @@ class HDACodec:
 
     nodes_count, nid = self.get_sub_nodes(self.afg)
     self.base_nid = nid
-    self.nodes = {}
     for i in range(nodes_count):
       self.nodes[nid] = HDANode(self, nid)
       nid += 1
-- 
1.6.5.6

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux