Blame SOURCES/0017-merge-Github-pull-request-22.patch

21ef37
From fd8dc9a997915d9e197233bb58622111c36ccb16 Mon Sep 17 00:00:00 2001
21ef37
From: Lyonel Vincent <lyonel@ezix.org>
21ef37
Date: Fri, 14 Oct 2016 14:28:42 +0200
21ef37
Subject: [PATCH 17/43] merge Github pull request 22
21ef37
21ef37
https://github.com/lyonel/lshw/pull/22
21ef37
21ef37
Parent #address-cells and #size-cells property tells how to parse
21ef37
reg property. Current code endup assigning 1 to address and size variable
21ef37
which is not correct.
21ef37
---
21ef37
 src/core/device-tree.cc | 10 ++++++++--
21ef37
 1 file changed, 8 insertions(+), 2 deletions(-)
21ef37
21ef37
diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc
21ef37
index 2823233..c2b7d15 100644
21ef37
--- a/src/core/device-tree.cc
21ef37
+++ b/src/core/device-tree.cc
21ef37
@@ -89,8 +89,14 @@ static vector < reg_entry > get_reg_property(const string & node)
21ef37
 {
21ef37
   vector < reg_entry > result;
21ef37
 
21ef37
-  uint32_t num_address_cells = get_u32(node + "/../#address-cells") || 1;
21ef37
-  uint32_t num_size_cells = get_u32(node + "/../#size-cells") || 1;
21ef37
+  uint32_t num_address_cells = 1;
21ef37
+  uint32_t num_size_cells = 1;
21ef37
+
21ef37
+  if (exists(node + "/../#address-cells"))
21ef37
+    num_address_cells = get_u32(node + "/../#address-cells");
21ef37
+  if (exists(node + "/../#size-cells"))
21ef37
+    num_size_cells = get_u32(node + "/../#size-cells");
21ef37
+
21ef37
   if (num_address_cells > 2 || num_size_cells > 2)
21ef37
     return result;
21ef37
 
21ef37
-- 
21ef37
2.10.2
21ef37