Attn: Code cleanup based on local CI build output
Modified code based on recommendations from local CI build. Cleaned up
some potential null pointer dereferencing code.
Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: I17fb40b25ce37627627c5112a6be786e2bac7c1f
diff --git a/attn/attn_handler.cpp b/attn/attn_handler.cpp
index 747f9d6..f8d0a21 100644
--- a/attn/attn_handler.cpp
+++ b/attn/attn_handler.cpp
@@ -74,7 +74,7 @@
// The processor FSI target is required for CFAM read
char path[16];
- sprintf(path, "/proc%d/fsi", proc);
+ sprintf(path, "/proc%d/fsi", (int)proc);
pdbg_target* attnTarget = pdbg_target_from_path(nullptr, path);
if (PDBG_TARGET_ENABLED == pdbg_target_probe(attnTarget))
@@ -90,7 +90,7 @@
}
else
{
- std::stringstream ss; // log message stream
+ ss.str(std::string()); // clear stream
ss << "cfam 0x1007 = 0x";
ss << std::hex << std::setw(8) << std::setfill('0');
ss << isr_val;
@@ -111,7 +111,7 @@
// corresponding to attentions that can generate an
// attention interrupt.
- std::stringstream ss; // log message stream
+ ss.str(std::string()); // clear stream
ss << "cfam 0x100d = 0x";
ss << std::hex << std::setw(8) << std::setfill('0');
ss << isr_mask;
diff --git a/attn/attn_logging.cpp b/attn/attn_logging.cpp
index d802437..014fc96 100644
--- a/attn/attn_logging.cpp
+++ b/attn/attn_logging.cpp
@@ -68,7 +68,7 @@
i_additional, ffdcTuples);
// log the event
- auto reply = bus.call(method);
+ bus.call_noreply(method);
}
}
diff --git a/attn/ti_handler.cpp b/attn/ti_handler.cpp
index eee3553..6c3f26c 100644
--- a/attn/ti_handler.cpp
+++ b/attn/ti_handler.cpp
@@ -243,6 +243,10 @@
void parseRawTiInfo(std::map<std::string, std::string>& i_map,
TiDataArea* i_buffer)
{
+ if (nullptr == i_buffer)
+ {
+ return;
+ }
uint32_t* tiDataArea = (uint32_t*)i_buffer;
std::stringstream ss;
@@ -269,6 +273,11 @@
void parsePhypOpalTiInfo(std::map<std::string, std::string>& i_map,
TiDataArea* i_tiDataArea)
{
+ if (nullptr == i_tiDataArea)
+ {
+ return;
+ }
+
std::stringstream ss;
ss << std::hex << std::showbase;
@@ -317,6 +326,11 @@
void parseHbTiInfo(std::map<std::string, std::string>& i_map,
TiDataArea* i_tiDataArea)
{
+ if (nullptr == i_tiDataArea)
+ {
+ return;
+ }
+
std::stringstream ss;
ss << std::hex << std::showbase;