Merge "sdm: Correct issues reported by cpplint tool"
diff --git a/sdm/include/private/hw_info_types.h b/sdm/include/private/hw_info_types.h
index 40022e3..1c78ad9 100644
--- a/sdm/include/private/hw_info_types.h
+++ b/sdm/include/private/hw_info_types.h
@@ -151,7 +151,7 @@
 
   HWPanelInfo() : port(kPortDefault), mode(kModeDefault), partial_update(false), left_align(false),
     width_align(false), top_align(false), height_align(false), min_roi_width(0), min_roi_height(0),
-    needs_roi_merge(false), dynamic_fps(false), min_fps(0), max_fps(0) { }
+    needs_roi_merge(false), dynamic_fps(false), min_fps(0), max_fps(0), is_primary_panel(false) { }
 
   bool operator !=(const HWPanelInfo &panel_info) {
     return ((port != panel_info.port) || (mode != panel_info.mode) ||
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index 8e91e3d..62c64a6 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -455,10 +455,8 @@
 
   DumpImpl::AppendString(buffer, length, "\n");
 
-  uint32_t num_layers = 0;
   uint32_t num_hw_layers = 0;
   if (hw_layers_.info.stack) {
-    num_layers = hw_layers_.info.stack->layer_count;
     num_hw_layers = hw_layers_.info.count;
   }
 
diff --git a/sdm/libs/core/display_primary.cpp b/sdm/libs/core/display_primary.cpp
index dd1beed..a218789 100644
--- a/sdm/libs/core/display_primary.cpp
+++ b/sdm/libs/core/display_primary.cpp
@@ -58,6 +58,7 @@
   error = DisplayBase::Init();
   if (error != kErrorNone) {
     HWPrimaryInterface::Destroy(hw_primary_intf_);
+    return error;
   }
 
   // Idle fallback feature is supported only for video mode panel.
diff --git a/sdm/libs/core/fb/hw_device.cpp b/sdm/libs/core/fb/hw_device.cpp
index 9d08323..465c12c 100644
--- a/sdm/libs/core/fb/hw_device.cpp
+++ b/sdm/libs/core/fb/hw_device.cpp
@@ -613,31 +613,30 @@
 }
 
 int HWDevice::GetFBNodeIndex(HWDeviceType device_type) {
-  int fb_node_index = -1;
   for (int i = 0; i <= kDeviceVirtual; i++) {
     HWPanelInfo *panel_info = new HWPanelInfo();
     GetHWPanelInfoByNode(i, panel_info);
     switch (device_type) {
     case kDevicePrimary:
       if (panel_info->is_primary_panel) {
-        fb_node_index = i;
+        return i;
       }
       break;
     case kDeviceHDMI:
       if (panel_info->port == kPortDTv) {
-        fb_node_index = i;
+        return i;
       }
       break;
     case kDeviceVirtual:
       if (panel_info->port == kPortWriteBack) {
-        fb_node_index = i;
+        return i;
       }
       break;
     default:
       break;
     }
   }
-  return fb_node_index;
+  return -1;
 }
 
 void HWDevice::PopulateHWPanelInfo() {
@@ -858,18 +857,24 @@
   bool ret_value = true;
   char hpdpath[kMaxStringLength];
   int hdmi_node_index = GetFBNodeIndex(kDeviceHDMI);
+  if (hdmi_node_index < 0) {
+    return false;
+  }
+
   snprintf(hpdpath , sizeof(hpdpath), "%s%d/hpd", fb_path_, hdmi_node_index);
   int hpdfd = Sys::open_(hpdpath, O_RDWR, 0);
   if (hpdfd < 0) {
-    DLOGE("Open failed = %s", hpdpath);
-    return kErrorHardware;
+    DLOGW("Open failed = %s", hpdpath);
+    return false;
   }
+
   char value = enable ? '1' : '0';
   ssize_t length = Sys::pwrite_(hpdfd, &value, 1, 0);
   if (length <= 0) {
     DLOGE("Write failed 'hpd' = %d", enable);
     ret_value = false;
   }
+
   Sys::close_(hpdfd);
 
   return ret_value;
diff --git a/sdm/libs/core/fb/hw_primary.cpp b/sdm/libs/core/fb/hw_primary.cpp
index f4381b5..0c795ac 100644
--- a/sdm/libs/core/fb/hw_primary.cpp
+++ b/sdm/libs/core/fb/hw_primary.cpp
@@ -175,7 +175,11 @@
   }
 
   if (config_changed_) {
-    PopulateDisplayAttributes();
+    DisplayError error = PopulateDisplayAttributes();
+    if (error != kErrorNone) {
+      return error;
+    }
+
     config_changed_ = false;
   }