From 4852615c327b40b0b4b576109c84221eb975fb9d Mon Sep 17 00:00:00 2001
From: David Collins <collinsd@codeaurora.org>
Date: Fri, 23 Jun 2017 15:42:48 -0700
Subject: [PATCH] lrdp-v2: cpr3_info: ignore apm data structure when it is
 unused

Do not attempt to parse the APM data structure if the pointer to
it is null.

Change-Id: I2894c217a5deaafe1ded2a628ddeefa026ca030b
---
 linux-ramdump-parser-v2/parsers/cpr3_info.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/linux-ramdump-parser-v2/parsers/cpr3_info.py b/linux-ramdump-parser-v2/parsers/cpr3_info.py
index 3f0be29..24dadee 100644
--- a/linux-ramdump-parser-v2/parsers/cpr3_info.py
+++ b/linux-ramdump-parser-v2/parsers/cpr3_info.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+# Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License version 2 and
@@ -218,6 +218,9 @@ class CPR3Info(RamParser):
         if apm_thresh_volt == 0:
             return
         tmp = '%-30s = %d uV\n' % ("APM threshold", apm_thresh_volt)
+        if apm_addr == 0:
+            self.output.append(tmp)
+            return
         apm_supply = self.ramdump.read_int(
             apm_addr + self.ramdump.field_offset('struct msm_apm_ctrl_dev',
                                                  'supply'))
-- 
GitLab