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