PEL: Fix more cppcheck warnings

This is the second of two commits to fix most of the cppcheck warnings
in the PEL code.  It doesn't fix all of them because some are false
positives and some are just suggestions.

It's broken up into two commits to make them smaller.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Id9f462386df85fd25d09529d6b410115ff4ccba8
diff --git a/extensions/openpower-pels/user_header.cpp b/extensions/openpower-pels/user_header.cpp
index b2365a9..49da47a 100644
--- a/extensions/openpower-pels/user_header.cpp
+++ b/extensions/openpower-pels/user_header.cpp
@@ -103,12 +103,13 @@
     {
         bool mfgSevStatus = false;
         bool mfgActionFlagStatus = false;
-        std::optional<uint8_t> sev = std::nullopt;
-        uint16_t val = 0;
 
         // Get the mfg severity & action flags
         if (entry.mfgSeverity || entry.mfgActionFlags)
         {
+            std::optional<uint8_t> sev = std::nullopt;
+            uint16_t val = 0;
+
             if (entry.mfgSeverity)
             {
                 // Find the mf severity possibly dependent on the system type.
@@ -161,7 +162,6 @@
                 {
                     // Either someone  screwed up the message registry
                     // or getSystemNames failed.
-                    std::string types;
                     log<level::ERR>(
                         "Failed finding the severity in the message registry",
                         phosphor::logging::entry("ERROR=%s",