diff --git a/.ci/.common.sh b/.ci/.common.sh
index 7fa5a88..4dbe745 100644
--- a/.ci/.common.sh
+++ b/.ci/.common.sh
@@ -6,3 +6,14 @@
 CXXARGS="-fPIC -Wall -Werror -DPLATFORM_SDK_VERSION=30 -Wsign-promo -Wimplicit-fallthrough"
 CXXARGS+=" -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -Wno-gnu-include-next "
 CXXARGS+=" -fvisibility-inlines-hidden -std=gnu++17 -DHWC2_USE_CPP11 -DHWC2_INCLUDE_STRINGIFICATION -fexceptions -fno-rtti"
+
+BUILD_FILES=(
+drm/DrmConnector.cpp
+drm/DrmCrtc.cpp
+drm/DrmDevice.cpp
+drm/DrmEncoder.cpp
+drm/DrmEventListener.cpp
+drm/DrmMode.cpp
+drm/DrmProperty.cpp
+utils/Worker.cpp
+)
diff --git a/.ci/.gitlab-ci-clang-build.sh b/.ci/.gitlab-ci-clang-build.sh
index 11dd817..1070365 100755
--- a/.ci/.gitlab-ci-clang-build.sh
+++ b/.ci/.gitlab-ci-clang-build.sh
@@ -2,17 +2,6 @@
 
 . ./.ci/.common.sh
 
-BUILD_FILES=(
-drm/DrmConnector.cpp
-drm/DrmCrtc.cpp
-drm/DrmDevice.cpp
-drm/DrmEncoder.cpp
-drm/DrmEventListener.cpp
-drm/DrmMode.cpp
-drm/DrmProperty.cpp
-utils/Worker.cpp
-)
-
 set -xe
 
 for source in "${BUILD_FILES[@]}"
diff --git a/.ci/.gitlab-ci-clang-tidy-coarse.sh b/.ci/.gitlab-ci-clang-tidy-coarse.sh
index bb7373c..cd22516 100755
--- a/.ci/.gitlab-ci-clang-tidy-coarse.sh
+++ b/.ci/.gitlab-ci-clang-tidy-coarse.sh
@@ -2,12 +2,28 @@
 
 . ./.ci/.common.sh
 
-TIDY_FILES=(
-)
+TIDY_COARSE_CHECKS="-*,android-*,bugprone-*,cert-*,"
+TIDY_COARSE_CHECKS+="google-*,"
+TIDY_COARSE_CHECKS+="-google-readability-braces-around-statements,"
+TIDY_COARSE_CHECKS+="-google-readability-casting,"
+TIDY_COARSE_CHECKS+="misc-*,"
+TIDY_COARSE_CHECKS+="modernize-*,"
+TIDY_COARSE_CHECKS+="-modernize-avoid-c-arrays,"
+TIDY_COARSE_CHECKS+="-modernize-use-trailing-return-type,"
+TIDY_COARSE_CHECKS+="performance-*,"
+TIDY_COARSE_CHECKS+="portability-*,"
+TIDY_COARSE_CHECKS+="readability-*,"
+TIDY_COARSE_CHECKS+="-readability-braces-around-statements,"
+TIDY_COARSE_CHECKS+="-readability-convert-member-functions-to-static,"
+TIDY_COARSE_CHECKS+="-readability-implicit-bool-conversion,"
+TIDY_COARSE_CHECKS+="-readability-magic-numbers,"
+TIDY_COARSE_CHECKS+="-readability-use-anyofallof"
+
+TIDY_FILES=( "${BUILD_FILES[@]}" )
 
 set -xe
 
 for source in "${TIDY_FILES[@]}"
 do
-    $CLANG_TIDY $source -- -x c++ $INCLUDE_DIRS
+    $CLANG_TIDY $source --checks=$TIDY_COARSE_CHECKS -- -x c++ $INCLUDE_DIRS
 done
diff --git a/DrmHwcTwo.cpp b/DrmHwcTwo.cpp
index db5f351..02ad03d 100644
--- a/DrmHwcTwo.cpp
+++ b/DrmHwcTwo.cpp
@@ -22,9 +22,9 @@
 #include <cutils/properties.h>
 #include <hardware/hardware.h>
 #include <hardware/hwcomposer2.h>
-#include <inttypes.h>
 #include <log/log.h>
 
+#include <cinttypes>
 #include <string>
 
 #include "backend/BackendManager.h"
@@ -83,8 +83,8 @@
     }
   }
 
-  auto &drmDevices = resource_manager_.getDrmDevices();
-  for (auto &device : drmDevices) {
+  auto &drm_devices = resource_manager_.getDrmDevices();
+  for (auto &device : drm_devices) {
     device->RegisterHotplugHandler(new DrmHotplugHandler(this, device.get()));
   }
   return ret;
@@ -103,12 +103,12 @@
 HWC2::Error DrmHwcTwo::CreateVirtualDisplay(uint32_t width, uint32_t height,
                                             int32_t *format,
                                             hwc2_display_t *display) {
-  // TODO: Implement virtual display
+  // TODO(nobody): Implement virtual display
   return unsupported(__func__, width, height, format, display);
 }
 
 HWC2::Error DrmHwcTwo::DestroyVirtualDisplay(hwc2_display_t display) {
-  // TODO: Implement virtual display
+  // TODO(nobody): Implement virtual display
   return unsupported(__func__, display);
 }
 
@@ -116,7 +116,7 @@
     DrmHwcTwo::HwcDisplay::Stats delta) {
   if (delta.total_pixops_ == 0)
     return "No stats yet";
-  double Ratio = 1.0 - double(delta.gpu_pixops_) / double(delta.total_pixops_);
+  double ratio = 1.0 - double(delta.gpu_pixops_) / double(delta.total_pixops_);
 
   return (std::stringstream()
           << " Total frames count: " << delta.total_frames_ << "\n"
@@ -130,7 +130,7 @@
           << " Pixel operations (free units)"
           << " : [TOTAL: " << delta.total_pixops_
           << " / GPU: " << delta.gpu_pixops_ << "]\n"
-          << " Composition efficiency: " << Ratio)
+          << " Composition efficiency: " << ratio)
       .str();
 }
 
@@ -153,8 +153,8 @@
   supported(__func__);
 
   if (outBuffer != nullptr) {
-    auto copiedBytes = mDumpString.copy(outBuffer, *outSize);
-    *outSize = static_cast<uint32_t>(copiedBytes);
+    auto copied_bytes = mDumpString.copy(outBuffer, *outSize);
+    *outSize = static_cast<uint32_t>(copied_bytes);
     return;
   }
 
@@ -170,7 +170,7 @@
 }
 
 uint32_t DrmHwcTwo::GetMaxVirtualDisplayCount() {
-  // TODO: Implement virtual display
+  // TODO(nobody): Implement virtual display
   unsupported(__func__);
   return 0;
 }
@@ -183,8 +183,8 @@
   switch (static_cast<HWC2::Callback>(descriptor)) {
     case HWC2::Callback::Hotplug: {
       SetHotplugCallback(data, function);
-      auto &drmDevices = resource_manager_.getDrmDevices();
-      for (auto &device : drmDevices)
+      auto &drm_devices = resource_manager_.getDrmDevices();
+      for (auto &device : drm_devices)
         HandleInitialHotplugState(device.get());
       break;
     }
@@ -212,7 +212,7 @@
                                   hwc2_display_t handle, HWC2::DisplayType type)
     : resource_manager_(resource_manager),
       drm_(drm),
-      importer_(importer),
+      importer_(std::move(importer)),
       handle_(handle),
       type_(type),
       color_transform_hint_(HAL_COLOR_TRANSFORM_IDENTITY) {
@@ -250,7 +250,7 @@
   char use_overlay_planes_prop[PROPERTY_VALUE_MAX];
   property_get("vendor.hwc.drm.use_overlay_planes", use_overlay_planes_prop,
                "1");
-  bool use_overlay_planes = atoi(use_overlay_planes_prop);
+  bool use_overlay_planes = strtol(use_overlay_planes_prop, nullptr, 10);
   for (auto &plane : *planes) {
     if (plane->type() == DRM_PLANE_TYPE_PRIMARY)
       primary_planes_.push_back(plane);
@@ -288,7 +288,7 @@
 HWC2::Error DrmHwcTwo::HwcDisplay::ChosePreferredConfig() {
   // Fetch the number of modes from the display
   uint32_t num_configs;
-  HWC2::Error err = GetDisplayConfigs(&num_configs, NULL);
+  HWC2::Error err = GetDisplayConfigs(&num_configs, nullptr);
   if (err != HWC2::Error::None || !num_configs)
     return err;
 
@@ -373,11 +373,10 @@
   if (width > max.first || height > max.second)
     return HWC2::Error::Unsupported;
 
-  if (dataspace != HAL_DATASPACE_UNKNOWN &&
-      dataspace != HAL_DATASPACE_STANDARD_UNSPECIFIED)
+  if (dataspace != HAL_DATASPACE_UNKNOWN)
     return HWC2::Error::Unsupported;
 
-  // TODO: Validate format can be handled by either GL or planes
+  // TODO(nobody): Validate format can be handled by either GL or planes
   return HWC2::Error::None;
 }
 
@@ -420,7 +419,7 @@
       break;
     case HWC2::Attribute::VsyncPeriod:
       // in nanoseconds
-      *value = 1000 * 1000 * 1000 / mode->v_refresh();
+      *value = 1000.0 * 1000.0 * 1000.0 / mode->v_refresh();
       break;
     case HWC2::Attribute::DpiX:
       // Dots per 1000 inches
@@ -466,7 +465,8 @@
   // at least one non-interlaced alternative and only offer a single WxH@R
   // mode with at least the prefered mode from in DrmConnector::UpdateModes()
 
-  // TODO: Remove the following block of code until AOSP handles all modes
+  // TODO(nobody): Remove the following block of code until AOSP handles all
+  // modes
   std::vector<DrmMode> sel_modes;
 
   // Add the preferred mode first to be sure it's not dropped
@@ -485,11 +485,11 @@
   // Cycle over the modes and filter out "similar" modes, keeping only the
   // first ones in the order given by DRM (from CEA ids and timings order)
   for (const DrmMode &mode : connector_->modes()) {
-    // TODO: Remove this when 3D Attributes are in AOSP
+    // TODO(nobody): Remove this when 3D Attributes are in AOSP
     if (mode.flags() & DRM_MODE_FLAG_3D_MASK)
       continue;
 
-    // TODO: Remove this when the Interlaced attribute is in AOSP
+    // TODO(nobody): Remove this when the Interlaced attribute is in AOSP
     if (mode.flags() & DRM_MODE_FLAG_INTERLACE) {
       auto m = std::find_if(connector_->modes().begin(),
                             connector_->modes().end(),
@@ -506,7 +506,7 @@
 
     // Search for a similar WxH@R mode in the filtered list and drop it if
     // another mode with the same WxH@R has already been selected
-    // TODO: Remove this when AOSP handles duplicates modes
+    // TODO(nobody): Remove this when AOSP handles duplicates modes
     auto m = std::find_if(sel_modes.begin(), sel_modes.end(),
                           [&mode](DrmMode const &m) {
                             return m.h_display() == mode.h_display() &&
@@ -554,7 +554,7 @@
                                                       hwc2_layer_t *layers,
                                                       int32_t *layer_requests) {
   supported(__func__);
-  // TODO: I think virtual display should request
+  // TODO(nobody): I think virtual display should request
   //      HWC2_DISPLAY_REQUEST_WRITE_CLIENT_TARGET_TO_OUTPUT here
   unsupported(__func__, display_requests, num_elements, layers, layer_requests);
   *num_elements = 0;
@@ -589,9 +589,10 @@
 
   for (std::pair<const hwc2_layer_t, DrmHwcTwo::HwcLayer> &l : layers_) {
     ++num_layers;
-    if (layers == NULL || fences == NULL) {
+    if (layers == nullptr || fences == nullptr)
       continue;
-    } else if (num_layers > *num_elements) {
+
+    if (num_layers > *num_elements) {
       ALOGW("Overflow num_elements %d/%d", num_layers, *num_elements);
       return HWC2::Error::None;
     }
@@ -628,7 +629,7 @@
   DrmCompositionDisplayLayersMap &map = layers_map.back();
 
   map.display = static_cast<int>(handle_);
-  map.geometry_changed = true;  // TODO: Fix this
+  map.geometry_changed = true;  // TODO(nobody): Fix this
 
   // order the layers by z-order
   bool use_client_layer = false;
@@ -670,7 +671,7 @@
                                                            .CreateComposition();
   composition->Init(drm_, crtc_, importer_.get(), planner_.get(), frame_no_);
 
-  // TODO: Don't always assume geometry changed
+  // TODO(nobody): Don't always assume geometry changed
   int ret = composition->SetLayers(map.layers.data(), map.layers.size(), true);
   if (ret) {
     ALOGE("Failed to set layers in the composition ret=%d", ret);
@@ -783,10 +784,10 @@
   hwc_drm_bo bo{};
   BufferInfoGetter::GetInstance()->ConvertBoInfo(target, &bo);
 
-  hwc_frect_t source_crop = {.left = 0.0f,
-                             .top = 0.0f,
-                             .right = bo.width + 0.0f,
-                             .bottom = bo.height + 0.0f};
+  hwc_frect_t source_crop = {.left = 0.0F,
+                             .top = 0.0F,
+                             .right = bo.width + 0.0F,
+                             .bottom = bo.height + 0.0F};
   client_layer_.SetLayerSourceCrop(source_crop);
 
   return HWC2::Error::None;
@@ -825,7 +826,7 @@
 HWC2::Error DrmHwcTwo::HwcDisplay::SetOutputBuffer(buffer_handle_t buffer,
                                                    int32_t release_fence) {
   supported(__func__);
-  // TODO: Need virtual display support
+  // TODO(nobody): Need virtual display support
   return unsupported(__func__, buffer, release_fence);
 }
 
@@ -938,7 +939,8 @@
 }
 
 HWC2::Error DrmHwcTwo::HwcDisplay::GetSupportedContentTypes(
-    uint32_t *outNumSupportedContentTypes, uint32_t *outSupportedContentTypes) {
+    uint32_t *outNumSupportedContentTypes,
+    const uint32_t *outSupportedContentTypes) {
   if (outSupportedContentTypes == nullptr)
     *outNumSupportedContentTypes = 0;
 
@@ -986,7 +988,7 @@
     uint32_t *outNumCapabilities, uint32_t *outCapabilities) {
   unsupported(__func__, outCapabilities);
 
-  if (outNumCapabilities == NULL) {
+  if (outNumCapabilities == nullptr) {
     return HWC2::Error::BadParameter;
   }
 
@@ -1071,7 +1073,7 @@
 }
 
 HWC2::Error DrmHwcTwo::HwcLayer::SetLayerColor(hwc_color_t color) {
-  // TODO: Put to client composition here?
+  // TODO(nobody): Put to client composition here?
   supported(__func__);
   layer_color_ = color;
   return HWC2::Error::None;
@@ -1103,7 +1105,7 @@
 HWC2::Error DrmHwcTwo::HwcLayer::SetLayerSidebandStream(
     const native_handle_t *stream) {
   supported(__func__);
-  // TODO: We don't support sideband
+  // TODO(nobody): We don't support sideband
   return unsupported(__func__, stream);
 }
 
@@ -1115,7 +1117,7 @@
 
 HWC2::Error DrmHwcTwo::HwcLayer::SetLayerSurfaceDamage(hwc_region_t damage) {
   supported(__func__);
-  // TODO: We don't use surface damage, marking as unsupported
+  // TODO(nobody): We don't use surface damage, marking as unsupported
   unsupported(__func__, damage);
   return HWC2::Error::None;
 }
@@ -1128,7 +1130,7 @@
 
 HWC2::Error DrmHwcTwo::HwcLayer::SetLayerVisibleRegion(hwc_region_t visible) {
   supported(__func__);
-  // TODO: We don't use this information, marking as unsupported
+  // TODO(nobody): We don't use this information, marking as unsupported
   unsupported(__func__, visible);
   return HWC2::Error::None;
 }
@@ -1163,7 +1165,7 @@
   layer->acquire_fence = acquire_fence_.Release();
   layer->release_fence = std::move(release_fence);
   layer->SetDisplayFrame(display_frame_);
-  layer->alpha = static_cast<uint16_t>(65535.0f * alpha_ + 0.5f);
+  layer->alpha = lround(65535.0F * alpha_);
   layer->SetSourceCrop(source_crop_);
   layer->SetTransform(static_cast<int32_t>(transform_));
   layer->dataspace = dataspace_;
@@ -1484,7 +1486,7 @@
                     &HwcLayer::SetLayerZOrder, uint32_t>);
     case HWC2::FunctionDescriptor::Invalid:
     default:
-      return NULL;
+      return nullptr;
   }
 }
 
@@ -1492,7 +1494,7 @@
 int DrmHwcTwo::HookDevOpen(const struct hw_module_t *module, const char *name,
                            struct hw_device_t **dev) {
   supported(__func__);
-  if (strcmp(name, HWC_HARDWARE_COMPOSER)) {
+  if (strcmp(name, HWC_HARDWARE_COMPOSER) != 0) {
     ALOGE("Invalid module name- %s", name);
     return -EINVAL;
   }
@@ -1511,7 +1513,7 @@
 
   ctx->common.module = const_cast<hw_module_t *>(module);
   *dev = &ctx->common;
-  ctx.release();
+  ctx.release();  // NOLINT(bugprone-unused-return-value)
   return 0;
 }
 }  // namespace android
@@ -1527,6 +1529,6 @@
     .name = "DrmHwcTwo module",
     .author = "The Android Open Source Project",
     .methods = &hwc2_module_methods,
-    .dso = NULL,
+    .dso = nullptr,
     .reserved = {0},
 };
diff --git a/DrmHwcTwo.h b/DrmHwcTwo.h
index 7a08d64..c75b2e9 100644
--- a/DrmHwcTwo.h
+++ b/DrmHwcTwo.h
@@ -137,7 +137,7 @@
     HWC2::Error SetLayerSurfaceDamage(hwc_region_t damage);
     HWC2::Error SetLayerTransform(int32_t transform);
     HWC2::Error SetLayerVisibleRegion(hwc_region_t visible);
-    HWC2::Error SetLayerZOrder(uint32_t z);
+    HWC2::Error SetLayerZOrder(uint32_t order);
 
    private:
     // sf_type_ stores the initial type given to us by surfaceflinger,
@@ -227,8 +227,9 @@
         hwc_vsync_period_change_constraints_t *vsyncPeriodChangeConstraints,
         hwc_vsync_period_change_timeline_t *outTimeline);
     HWC2::Error SetAutoLowLatencyMode(bool on);
-    HWC2::Error GetSupportedContentTypes(uint32_t *outNumSupportedContentTypes,
-                                         uint32_t *outSupportedContentTypes);
+    HWC2::Error GetSupportedContentTypes(
+        uint32_t *outNumSupportedContentTypes,
+        const uint32_t *outSupportedContentTypes);
 
     HWC2::Error SetContentType(int32_t contentType);
 #endif
diff --git a/backend/Backend.cpp b/backend/Backend.cpp
index 887eb0e..15a9ff1 100644
--- a/backend/Backend.cpp
+++ b/backend/Backend.cpp
@@ -36,7 +36,8 @@
   if (avail_planes < display->layers().size())
     avail_planes--;
 
-  std::map<uint32_t, DrmHwcTwo::HwcLayer *> z_map, z_map_tmp;
+  std::map<uint32_t, DrmHwcTwo::HwcLayer *> z_map;
+  std::map<uint32_t, DrmHwcTwo::HwcLayer *> z_map_tmp;
   uint32_t z_index = 0;
   // First create a map of layers and z_order values
   for (std::pair<const hwc2_layer_t, DrmHwcTwo::HwcLayer> &l :
@@ -49,7 +50,8 @@
   uint32_t total_pixops = display->CalcPixOps(z_map, 0, z_map.size());
   uint32_t gpu_pixops = 0;
 
-  int client_start = -1, client_size = 0;
+  int client_start = -1;
+  size_t client_size = 0;
 
   if (display->compositor().ShouldFlattenOnClient()) {
     client_start = 0;
@@ -58,17 +60,18 @@
   } else {
     std::tie(client_start, client_size) = GetClientLayers(display, z_map);
 
-    int extra_client = (z_map.size() - client_size) - avail_planes;
+    size_t extra_client = (z_map.size() - client_size) - avail_planes;
     if (extra_client > 0) {
-      int start = 0, steps;
+      int start = 0;
+      size_t steps;
       if (client_size != 0) {
-        int prepend = std::min(client_start, extra_client);
-        int append = std::min(int(z_map.size() - (client_start + client_size)),
-                              extra_client);
-        start = client_start - prepend;
+        size_t prepend = std::min((size_t)client_start, extra_client);
+        size_t append = std::min(z_map.size() - (client_start + client_size),
+                                 extra_client);
+        start = client_start - (int)prepend;
         client_size += extra_client;
         steps = 1 + std::min(std::min(append, prepend),
-                             int(z_map.size()) - (start + client_size));
+                             z_map.size() - (start + client_size));
       } else {
         client_size = extra_client;
         steps = 1 + z_map.size() - extra_client;
@@ -107,15 +110,16 @@
   return *num_types ? HWC2::Error::HasChanges : HWC2::Error::None;
 }
 
-std::tuple<int, int> Backend::GetClientLayers(
+std::tuple<int, size_t> Backend::GetClientLayers(
     DrmHwcTwo::HwcDisplay *display,
     const std::map<uint32_t, DrmHwcTwo::HwcLayer *> &z_map) {
-  int client_start = -1, client_size = 0;
+  int client_start = -1;
+  size_t client_size = 0;
 
-  for (auto & [ z_order, layer ] : z_map) {
+  for (auto &[z_order, layer] : z_map) {
     if (IsClientLayer(display, layer)) {
       if (client_start < 0)
-        client_start = z_order;
+        client_start = (int)z_order;
       client_size = (z_order - client_start) + 1;
     }
   }
diff --git a/backend/Backend.h b/backend/Backend.h
index 898fece..2725809 100644
--- a/backend/Backend.h
+++ b/backend/Backend.h
@@ -27,7 +27,7 @@
   virtual HWC2::Error ValidateDisplay(DrmHwcTwo::HwcDisplay *display,
                                       uint32_t *num_types,
                                       uint32_t *num_requests);
-  virtual std::tuple<int, int> GetClientLayers(
+  virtual std::tuple<int, size_t> GetClientLayers(
       DrmHwcTwo::HwcDisplay *display,
       const std::map<uint32_t, DrmHwcTwo::HwcLayer *> &z_map);
   virtual bool IsClientLayer(DrmHwcTwo::HwcDisplay *display,
diff --git a/backend/BackendManager.cpp b/backend/BackendManager.cpp
index 0bacdcd..a346d46 100644
--- a/backend/BackendManager.cpp
+++ b/backend/BackendManager.cpp
@@ -23,7 +23,7 @@
 
 namespace android {
 
-const std::vector<std::string> BackendManager::client_devices_ = {
+const std::vector<std::string> BackendManager::kClientDevices = {
     "kirin",
     "mediatek-drm",
 };
@@ -45,7 +45,7 @@
   char backend_override[PROPERTY_VALUE_MAX];
   property_get("vendor.hwc.backend_override", backend_override,
                driver_name.c_str());
-  std::string backend_name(std::move(backend_override));
+  std::string backend_name(backend_override);
 
   display->set_backend(GetBackendByName(backend_name));
   if (!display->backend()) {
@@ -63,15 +63,15 @@
 }
 
 std::unique_ptr<Backend> BackendManager::GetBackendByName(std::string &name) {
-  if (!available_backends_.size()) {
+  if (available_backends_.empty()) {
     ALOGE("No backends are specified");
     return nullptr;
   }
 
   auto it = available_backends_.find(name);
   if (it == available_backends_.end()) {
-    auto it = std::find(client_devices_.begin(), client_devices_.end(), name);
-    name = it == client_devices_.end() ? "generic" : "client";
+    auto it = std::find(kClientDevices.begin(), kClientDevices.end(), name);
+    name = it == kClientDevices.end() ? "generic" : "client";
   }
 
   return available_backends_[name]();
diff --git a/backend/BackendManager.h b/backend/BackendManager.h
index e86c098..9b314db 100644
--- a/backend/BackendManager.h
+++ b/backend/BackendManager.h
@@ -48,7 +48,7 @@
  private:
   BackendManager() = default;
 
-  static const std::vector<std::string> client_devices_;
+  static const std::vector<std::string> kClientDevices;
 
   std::map<std::string, backend_constructor_t> available_backends_;
 };
diff --git a/bufferinfo/BufferInfoGetter.cpp b/bufferinfo/BufferInfoGetter.cpp
index afdc50e..d8e63a9 100644
--- a/bufferinfo/BufferInfoGetter.cpp
+++ b/bufferinfo/BufferInfoGetter.cpp
@@ -40,7 +40,7 @@
       ALOGW(
           "Generic buffer getter is not available. Falling back to legacy...");
 #endif
-      inst.reset(LegacyBufferInfoGetter::CreateInstance());
+      inst = LegacyBufferInfoGetter::CreateInstance();
 #if PLATFORM_SDK_VERSION >= 30
     }
 #endif
@@ -109,7 +109,7 @@
   }
 }
 
-__attribute__((weak)) LegacyBufferInfoGetter *
+__attribute__((weak)) std::unique_ptr<LegacyBufferInfoGetter>
 LegacyBufferInfoGetter::CreateInstance() {
   ALOGE("No legacy buffer info getters available");
   return nullptr;
diff --git a/bufferinfo/BufferInfoGetter.h b/bufferinfo/BufferInfoGetter.h
index 19ff02b..60ca985 100644
--- a/bufferinfo/BufferInfoGetter.h
+++ b/bufferinfo/BufferInfoGetter.h
@@ -51,7 +51,7 @@
 
   int ConvertBoInfo(buffer_handle_t handle, hwc_drm_bo_t *bo) override = 0;
 
-  static LegacyBufferInfoGetter *CreateInstance();
+  static std::unique_ptr<LegacyBufferInfoGetter> CreateInstance();
 
   static uint32_t ConvertHalFormatToDrm(uint32_t hal_format);
   const gralloc_module_t *gralloc_;
@@ -60,19 +60,18 @@
 #ifdef DISABLE_LEGACY_GETTERS
 #define LEGACY_BUFFER_INFO_GETTER(getter_)
 #else
-#define LEGACY_BUFFER_INFO_GETTER(getter_)                           \
-  LegacyBufferInfoGetter *LegacyBufferInfoGetter::CreateInstance() { \
-    auto *instance = new getter_();                                  \
-    if (!instance)                                                   \
-      return NULL;                                                   \
-                                                                     \
-    int ret = instance->Init();                                      \
-    if (ret) {                                                       \
-      ALOGE("Failed to initialize the " #getter_ " getter %d", ret); \
-      delete instance;                                               \
-      return NULL;                                                   \
-    }                                                                \
-    return instance;                                                 \
+#define LEGACY_BUFFER_INFO_GETTER(getter_)                             \
+  std::unique_ptr<LegacyBufferInfoGetter>                              \
+  LegacyBufferInfoGetter::CreateInstance() {                           \
+    auto instance = std::make_unique<getter_>();                       \
+    if (instance) {                                                    \
+      int ret = instance->Init();                                      \
+      if (ret) {                                                       \
+        ALOGE("Failed to initialize the " #getter_ " getter %d", ret); \
+        instance.reset();                                              \
+      }                                                                \
+    }                                                                  \
+    return std::move(instance);                                        \
   }
 #endif
 
diff --git a/bufferinfo/BufferInfoMapperMetadata.cpp b/bufferinfo/BufferInfoMapperMetadata.cpp
index 7d64ce8..516c7e1 100644
--- a/bufferinfo/BufferInfoMapperMetadata.cpp
+++ b/bufferinfo/BufferInfoMapperMetadata.cpp
@@ -21,13 +21,12 @@
 #include "BufferInfoMapperMetadata.h"
 
 #include <drm/drm_fourcc.h>
-#include <inttypes.h>
 #include <log/log.h>
 #include <ui/GraphicBufferMapper.h>
 #include <xf86drm.h>
 #include <xf86drmMode.h>
 
-using android::hardware::graphics::common::V1_1::BufferUsage;
+#include <cinttypes>
 
 namespace android {
 
diff --git a/bufferinfo/legacy/BufferInfoImagination.cpp b/bufferinfo/legacy/BufferInfoImagination.cpp
index 84c177e..b3c1d33 100644
--- a/bufferinfo/legacy/BufferInfoImagination.cpp
+++ b/bufferinfo/legacy/BufferInfoImagination.cpp
@@ -29,7 +29,7 @@
 
 int BufferInfoImagination::ConvertBoInfo(buffer_handle_t handle,
                                          hwc_drm_bo_t *bo) {
-  IMG_native_handle_t *hnd = (IMG_native_handle_t *)handle;
+  auto *hnd = (IMG_native_handle_t *)handle;
   if (!hnd)
     return -EINVAL;
 
diff --git a/bufferinfo/legacy/BufferInfoLibdrm.cpp b/bufferinfo/legacy/BufferInfoLibdrm.cpp
index c794810..1634f8a 100644
--- a/bufferinfo/legacy/BufferInfoLibdrm.cpp
+++ b/bufferinfo/legacy/BufferInfoLibdrm.cpp
@@ -30,11 +30,11 @@
 LEGACY_BUFFER_INFO_GETTER(BufferInfoLibdrm);
 
 enum chroma_order {
-  YCbCr,
-  YCrCb,
+  kYCbCr,
+  kYCrCb,
 };
 
-struct droid_yuv_format {
+struct DroidYuvFormat {
   /* Lookup keys */
   int native;                     /* HAL_PIXEL_FORMAT_ */
   enum chroma_order chroma_order; /* chroma order is {Cb, Cr} or {Cr, Cb} */
@@ -46,37 +46,37 @@
 
 /* The following table is used to look up a DRI image FourCC based
  * on native format and information contained in android_ycbcr struct. */
-static const struct droid_yuv_format droid_yuv_formats[] = {
+static const struct DroidYuvFormat kDroidYuvFormats[] = {
     /* Native format, YCrCb, Chroma step, DRI image FourCC */
-    {HAL_PIXEL_FORMAT_YCbCr_420_888, YCbCr, 2, DRM_FORMAT_NV12},
-    {HAL_PIXEL_FORMAT_YCbCr_420_888, YCbCr, 1, DRM_FORMAT_YUV420},
-    {HAL_PIXEL_FORMAT_YCbCr_420_888, YCrCb, 1, DRM_FORMAT_YVU420},
-    {HAL_PIXEL_FORMAT_YV12, YCrCb, 1, DRM_FORMAT_YVU420},
+    {HAL_PIXEL_FORMAT_YCbCr_420_888, kYCbCr, 2, DRM_FORMAT_NV12},
+    {HAL_PIXEL_FORMAT_YCbCr_420_888, kYCbCr, 1, DRM_FORMAT_YUV420},
+    {HAL_PIXEL_FORMAT_YCbCr_420_888, kYCrCb, 1, DRM_FORMAT_YVU420},
+    {HAL_PIXEL_FORMAT_YV12, kYCrCb, 1, DRM_FORMAT_YVU420},
     /* HACK: See droid_create_image_from_prime_fds() and
      * https://issuetracker.google.com/32077885. */
-    {HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, YCbCr, 2, DRM_FORMAT_NV12},
-    {HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, YCbCr, 1, DRM_FORMAT_YUV420},
-    {HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, YCrCb, 1, DRM_FORMAT_YVU420},
-    {HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, YCrCb, 1, DRM_FORMAT_AYUV},
-    {HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, YCrCb, 1, DRM_FORMAT_XYUV8888},
+    {HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, kYCbCr, 2, DRM_FORMAT_NV12},
+    {HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, kYCbCr, 1, DRM_FORMAT_YUV420},
+    {HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, kYCrCb, 1, DRM_FORMAT_YVU420},
+    {HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, kYCrCb, 1, DRM_FORMAT_AYUV},
+    {HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, kYCrCb, 1, DRM_FORMAT_XYUV8888},
 };
 
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
 
 static int get_fourcc_yuv(int native, enum chroma_order chroma_order,
                           int chroma_step) {
-  for (int i = 0; i < ARRAY_SIZE(droid_yuv_formats); ++i)
-    if (droid_yuv_formats[i].native == native &&
-        droid_yuv_formats[i].chroma_order == chroma_order &&
-        droid_yuv_formats[i].chroma_step == chroma_step)
-      return droid_yuv_formats[i].fourcc;
+  for (auto droid_yuv_format : kDroidYuvFormats)
+    if (droid_yuv_format.native == native &&
+        droid_yuv_format.chroma_order == chroma_order &&
+        droid_yuv_format.chroma_step == chroma_step)
+      return droid_yuv_format.fourcc;
 
   return -1;
 }
 
 static bool is_yuv(int native) {
-  for (int i = 0; i < ARRAY_SIZE(droid_yuv_formats); ++i)
-    if (droid_yuv_formats[i].native == native)
+  for (auto droid_yuv_format : kDroidYuvFormats)
+    if (droid_yuv_format.native == native)
       return true;
 
   return false;
@@ -109,11 +109,11 @@
   bo->offsets[0] = (size_t)ycbcr.y;
   /* We assume here that all the planes are located in one DMA-buf. */
   if ((size_t)ycbcr.cr < (size_t)ycbcr.cb) {
-    chroma_order = YCrCb;
+    chroma_order = kYCrCb;
     bo->offsets[1] = (size_t)ycbcr.cr;
     bo->offsets[2] = (size_t)ycbcr.cb;
   } else {
-    chroma_order = YCbCr;
+    chroma_order = kYCbCr;
     bo->offsets[1] = (size_t)ycbcr.cb;
     bo->offsets[2] = (size_t)ycbcr.cr;
   }
@@ -132,7 +132,7 @@
     ALOGW(
         "unsupported YUV format, native = %x, chroma_order = %s, chroma_step = "
         "%d",
-        bo->hal_format, chroma_order == YCbCr ? "YCbCr" : "YCrCb",
+        bo->hal_format, chroma_order == kYCbCr ? "YCbCr" : "YCrCb",
         (int)ycbcr.chroma_step);
     return false;
   }
diff --git a/bufferinfo/legacy/BufferInfoMaliHisi.cpp b/bufferinfo/legacy/BufferInfoMaliHisi.cpp
index 877a83f..559cb5c 100644
--- a/bufferinfo/legacy/BufferInfoMaliHisi.cpp
+++ b/bufferinfo/legacy/BufferInfoMaliHisi.cpp
@@ -70,8 +70,7 @@
                                       hwc_drm_bo_t *bo) {
   bool is_rgb;
 
-  private_handle_t const *hnd = reinterpret_cast<private_handle_t const *>(
-      handle);
+  auto const *hnd = reinterpret_cast<private_handle_t const *>(handle);
   if (!hnd)
     return -EINVAL;
 
diff --git a/bufferinfo/legacy/BufferInfoMaliMediatek.cpp b/bufferinfo/legacy/BufferInfoMaliMediatek.cpp
index ce47343..13c7a34 100644
--- a/bufferinfo/legacy/BufferInfoMaliMediatek.cpp
+++ b/bufferinfo/legacy/BufferInfoMaliMediatek.cpp
@@ -34,8 +34,7 @@
 
 int BufferInfoMaliMediatek::ConvertBoInfo(buffer_handle_t handle,
                                           hwc_drm_bo_t *bo) {
-  private_handle_t const *hnd = reinterpret_cast<private_handle_t const *>(
-      handle);
+  auto const *hnd = reinterpret_cast<private_handle_t const *>(handle);
   if (!hnd)
     return -EINVAL;
 
diff --git a/bufferinfo/legacy/BufferInfoMaliMeson.cpp b/bufferinfo/legacy/BufferInfoMaliMeson.cpp
index cf7a873..1dfe4d2 100644
--- a/bufferinfo/legacy/BufferInfoMaliMeson.cpp
+++ b/bufferinfo/legacy/BufferInfoMaliMeson.cpp
@@ -63,8 +63,7 @@
 
 int BufferInfoMaliMeson::ConvertBoInfo(buffer_handle_t handle,
                                        hwc_drm_bo_t *bo) {
-  private_handle_t const *hnd = reinterpret_cast<private_handle_t const *>(
-      handle);
+  auto const *hnd = reinterpret_cast<private_handle_t const *>(handle);
   if (!hnd)
     return -EINVAL;
 
diff --git a/bufferinfo/legacy/BufferInfoMinigbm.cpp b/bufferinfo/legacy/BufferInfoMinigbm.cpp
index d5ffa1f..f5e661f 100644
--- a/bufferinfo/legacy/BufferInfoMinigbm.cpp
+++ b/bufferinfo/legacy/BufferInfoMinigbm.cpp
@@ -31,7 +31,7 @@
 LEGACY_BUFFER_INFO_GETTER(BufferInfoMinigbm);
 
 int BufferInfoMinigbm::ConvertBoInfo(buffer_handle_t handle, hwc_drm_bo_t *bo) {
-  cros_gralloc_handle *gr_handle = (cros_gralloc_handle *)handle;
+  auto *gr_handle = (cros_gralloc_handle *)handle;
   if (!gr_handle)
     return -EINVAL;
 
diff --git a/compositor/DrmDisplayComposition.cpp b/compositor/DrmDisplayComposition.cpp
index 4d2e19a..1e9e127 100644
--- a/compositor/DrmDisplayComposition.cpp
+++ b/compositor/DrmDisplayComposition.cpp
@@ -19,11 +19,11 @@
 #include "DrmDisplayComposition.h"
 
 #include <log/log.h>
-#include <stdlib.h>
 #include <sync/sync.h>
 #include <xf86drmMode.h>
 
 #include <algorithm>
+#include <cstdlib>
 #include <unordered_set>
 
 #include "DrmDisplayCompositor.h"
@@ -32,9 +32,6 @@
 
 namespace android {
 
-DrmDisplayComposition::~DrmDisplayComposition() {
-}
-
 int DrmDisplayComposition::Init(DrmDevice *drm, DrmCrtc *crtc,
                                 Importer *importer, Planner *planner,
                                 uint64_t frame_no) {
@@ -211,7 +208,7 @@
     separator = true;
   }
 
-  uint32_t valid_bits = DrmHwcTransform::kFlipH | DrmHwcTransform::kFlipH |
+  uint32_t valid_bits = DrmHwcTransform::kFlipH | DrmHwcTransform::kFlipV |
                         DrmHwcTransform::kRotate90 |
                         DrmHwcTransform::kRotate180 |
                         DrmHwcTransform::kRotate270;
diff --git a/compositor/DrmDisplayComposition.h b/compositor/DrmDisplayComposition.h
index 73a9024..5d99d23 100644
--- a/compositor/DrmDisplayComposition.h
+++ b/compositor/DrmDisplayComposition.h
@@ -109,7 +109,7 @@
  public:
   DrmDisplayComposition() = default;
   DrmDisplayComposition(const DrmDisplayComposition &) = delete;
-  ~DrmDisplayComposition();
+  ~DrmDisplayComposition() = default;
 
   int Init(DrmDevice *drm, DrmCrtc *crtc, Importer *importer, Planner *planner,
            uint64_t frame_no);
diff --git a/compositor/DrmDisplayCompositor.cpp b/compositor/DrmDisplayCompositor.cpp
index 3ae42ef..b33c9c0 100644
--- a/compositor/DrmDisplayCompositor.cpp
+++ b/compositor/DrmDisplayCompositor.cpp
@@ -23,12 +23,12 @@
 #include <log/log.h>
 #include <pthread.h>
 #include <sched.h>
-#include <stdlib.h>
 #include <sync/sync.h>
-#include <time.h>
 #include <utils/Trace.h>
 
 #include <array>
+#include <cstdlib>
+#include <ctime>
 #include <sstream>
 #include <vector>
 
@@ -52,11 +52,11 @@
 
 class CompositorVsyncCallback : public VsyncCallback {
  public:
-  CompositorVsyncCallback(DrmDisplayCompositor *compositor)
+  explicit CompositorVsyncCallback(DrmDisplayCompositor *compositor)
       : compositor_(compositor) {
   }
 
-  void Callback(int display, int64_t timestamp) {
+  void Callback(int display, int64_t timestamp) override {
     compositor_->Vsync(display, timestamp);
   }
 
@@ -65,7 +65,7 @@
 };
 
 DrmDisplayCompositor::DrmDisplayCompositor()
-    : resource_manager_(NULL),
+    : resource_manager_(nullptr),
       display_(-1),
       initialized_(false),
       active_(false),
@@ -113,7 +113,7 @@
     ALOGE("Could not find drmdevice for display");
     return -EINVAL;
   }
-  int ret = pthread_mutex_init(&lock_, NULL);
+  int ret = pthread_mutex_init(&lock_, nullptr);
   if (ret) {
     ALOGE("Failed to initialize drm compositor lock %d\n", ret);
     return ret;
@@ -130,7 +130,7 @@
 
 std::unique_ptr<DrmDisplayComposition> DrmDisplayCompositor::CreateComposition()
     const {
-  return std::unique_ptr<DrmDisplayComposition>(new DrmDisplayComposition());
+  return std::make_unique<DrmDisplayComposition>();
 }
 
 std::unique_ptr<DrmDisplayComposition>
@@ -172,7 +172,7 @@
 DrmDisplayCompositor::GetActiveModeResolution() {
   DrmDevice *drm = resource_manager_->GetDrmDevice(display_);
   DrmConnector *connector = drm->GetConnectorForDisplay(display_);
-  if (connector == NULL) {
+  if (connector == nullptr) {
     ALOGE("Failed to determine display mode: no connector for display %d",
           display_);
     return std::make_tuple(0, 0, -ENODEV);
@@ -286,8 +286,8 @@
     return -ENOMEM;
   }
 
-  if (writeback_buffer != NULL) {
-    if (writeback_conn == NULL) {
+  if (writeback_buffer != nullptr) {
+    if (writeback_conn == nullptr) {
       ALOGE("Invalid arguments requested writeback without writeback conn");
       return -EINVAL;
     }
@@ -661,7 +661,7 @@
   if (DisablePlanes(active_composition_.get()))
     return;
 
-  active_composition_.reset(NULL);
+  active_composition_.reset(nullptr);
   vsync_worker_.VSyncControl(false);
 }
 
@@ -785,8 +785,8 @@
     ALOGE("Failed to find crtc for display %d", display_);
     return -EINVAL;
   }
-  // TODO what happens if planes could go to both CRTCs, I don't think it's
-  // handled anywhere
+  // TODO(nobody) what happens if planes could go to both CRTCs, I don't think
+  // it's handled anywhere
   std::vector<DrmPlane *> primary_planes;
   std::vector<DrmPlane *> overlay_planes;
   for (auto &plane : drm->planes()) {
@@ -896,10 +896,10 @@
     SetFlattening(FlatteningState::kClientRequested);
     refresh_callback_hook_(refresh_callback_data_, display_);
     return 0;
-  } else {
-    ALOGV("No writeback connector available");
-    return -EINVAL;
   }
+
+  ALOGV("No writeback connector available");
+  return -EINVAL;
 }
 
 // Flatten a scene by enabling the writeback connector attached
@@ -976,7 +976,7 @@
     return ret;
   }
 
-  DrmCompositionPlane squashed_comp(DrmCompositionPlane::Type::kLayer, NULL,
+  DrmCompositionPlane squashed_comp(DrmCompositionPlane::Type::kLayer, nullptr,
                                     crtc);
   for (auto &drmplane : drm->planes()) {
     if (!drmplane->GetCrtcSupported(*crtc))
@@ -1061,7 +1061,7 @@
     return ret;
   }
 
-  DrmCompositionPlane squashed_comp(DrmCompositionPlane::Type::kLayer, NULL,
+  DrmCompositionPlane squashed_comp(DrmCompositionPlane::Type::kLayer, nullptr,
                                     crtc);
   for (auto &drmplane : resource_manager_->GetDrmDevice(display_)->planes()) {
     if (!drmplane->GetCrtcSupported(*crtc))
@@ -1106,12 +1106,10 @@
   if (writeback_conn->display() != display_) {
     SetFlattening(FlatteningState::kConcurrent);
     return FlattenConcurrent(writeback_conn);
-  } else {
-    SetFlattening(FlatteningState::kSerial);
-    return FlattenSerial(writeback_conn);
   }
 
-  return 0;
+  SetFlattening(FlatteningState::kSerial);
+  return FlattenSerial(writeback_conn);
 }
 
 bool DrmDisplayCompositor::CountdownExpired() const {
@@ -1149,7 +1147,7 @@
 
   uint64_t cur_ts = ts.tv_sec * 1000 * 1000 * 1000 + ts.tv_nsec;
   uint64_t num_ms = (cur_ts - dump_last_timestamp_ns_) / (1000 * 1000);
-  float fps = num_ms ? (num_frames * 1000.0f) / (num_ms) : 0.0f;
+  float fps = num_ms ? (num_frames * 1000.0F) / (num_ms) : 0.0F;
 
   *out << "--DrmDisplayCompositor[" << display_
        << "]: num_frames=" << num_frames << " num_ms=" << num_ms
diff --git a/compositor/Planner.cpp b/compositor/Planner.cpp
index f4b5c51..fb6a8c3 100644
--- a/compositor/Planner.cpp
+++ b/compositor/Planner.cpp
@@ -24,7 +24,7 @@
 
 namespace android {
 
-std::unique_ptr<Planner> Planner::CreateInstance(DrmDevice *) {
+std::unique_ptr<Planner> Planner::CreateInstance(DrmDevice * /*device*/) {
   std::unique_ptr<Planner> planner(new Planner);
   planner->AddStage<PlanStageGreedy>();
   return planner;
@@ -123,7 +123,6 @@
     std::map<size_t, DrmHwcLayer *> &layers, DrmCrtc *crtc,
     std::vector<DrmPlane *> *planes) {
   int ret;
-  int protected_zorder = -1;
   for (auto i = layers.begin(); i != layers.end();) {
     if (!i->second->protected_usage()) {
       ++i;
@@ -137,7 +136,6 @@
       return ret;
     }
 
-    protected_zorder = i->first;
     i = layers.erase(i);
   }
 
@@ -155,7 +153,8 @@
     // We don't have any planes left
     if (ret == -ENOENT)
       break;
-    else if (ret) {
+
+    if (ret) {
       ALOGE("Failed to emplace layer %zu, dropping it", i->first);
       return ret;
     }
diff --git a/drm/DrmConnector.cpp b/drm/DrmConnector.cpp
index 11c2bd2..cfafc1d 100644
--- a/drm/DrmConnector.cpp
+++ b/drm/DrmConnector.cpp
@@ -18,11 +18,11 @@
 
 #include "DrmConnector.h"
 
-#include <errno.h>
-#include <stdint.h>
 #include <xf86drmMode.h>
 
 #include <array>
+#include <cerrno>
+#include <cstdint>
 #include <sstream>
 
 #include "DrmDevice.h"
@@ -30,7 +30,7 @@
 
 namespace android {
 
-constexpr size_t TYPES_COUNT = 17;
+constexpr size_t kTypesCount = 17;
 
 DrmConnector::DrmConnector(DrmDevice *drm, drmModeConnectorPtr c,
                            DrmEncoder *current_encoder,
@@ -144,19 +144,19 @@
 }
 
 std::string DrmConnector::name() const {
-  constexpr std::array<const char *, TYPES_COUNT> names =
+  constexpr std::array<const char *, kTypesCount> kNames =
       {"None",   "VGA",  "DVI-I",     "DVI-D",   "DVI-A", "Composite",
        "SVIDEO", "LVDS", "Component", "DIN",     "DP",    "HDMI-A",
        "HDMI-B", "TV",   "eDP",       "Virtual", "DSI"};
 
-  if (type_ < TYPES_COUNT) {
+  if (type_ < kTypesCount) {
     std::ostringstream name_buf;
-    name_buf << names[type_] << "-" << type_id_;
+    name_buf << kNames[type_] << "-" << type_id_;
     return name_buf.str();
-  } else {
-    ALOGE("Unknown type in connector %d, could not make his name", id_);
-    return "None";
   }
+
+  ALOGE("Unknown type in connector %d, could not make his name", id_);
+  return "None";
 }
 
 int DrmConnector::UpdateModes() {
@@ -194,7 +194,7 @@
     }
   }
   modes_.swap(new_modes);
-  if (!preferred_mode_found && modes_.size() != 0) {
+  if (!preferred_mode_found && !modes_.empty()) {
     preferred_mode_id_ = modes_[0].id();
   }
   return 0;
diff --git a/drm/DrmCrtc.cpp b/drm/DrmCrtc.cpp
index 3c05ba8..4da08fe 100644
--- a/drm/DrmCrtc.cpp
+++ b/drm/DrmCrtc.cpp
@@ -18,10 +18,11 @@
 
 #include "DrmCrtc.h"
 
-#include <stdint.h>
 #include <utils/log.h>
 #include <xf86drmMode.h>
 
+#include <cstdint>
+
 #include "DrmDevice.h"
 
 namespace android {
diff --git a/drm/DrmDevice.cpp b/drm/DrmDevice.cpp
index 818261d..52d81d5 100644
--- a/drm/DrmDevice.cpp
+++ b/drm/DrmDevice.cpp
@@ -18,35 +18,35 @@
 
 #include "DrmDevice.h"
 
-#include <errno.h>
 #include <fcntl.h>
-#include <stdint.h>
 #include <xf86drm.h>
 #include <xf86drmMode.h>
 
 #include <algorithm>
 #include <array>
+#include <cerrno>
 #include <cinttypes>
+#include <cstdint>
 #include <sstream>
 #include <string>
 
 #include "utils/log.h"
 #include "utils/properties.h"
 
-static void trim_left(std::string &str) {
-  str.erase(std::begin(str),
-            std::find_if(std::begin(str), std::end(str),
-                         [](int ch) { return !std::isspace(ch); }));
+static void trim_left(std::string *str) {
+  str->erase(std::begin(*str),
+             std::find_if(std::begin(*str), std::end(*str),
+                          [](int ch) { return std::isspace(ch) == 0; }));
 }
 
-static void trim_right(std::string &str) {
-  str.erase(std::find_if(std::rbegin(str), std::rend(str),
-                         [](int ch) { return !std::isspace(ch); })
-                .base(),
-            std::end(str));
+static void trim_right(std::string *str) {
+  str->erase(std::find_if(std::rbegin(*str), std::rend(*str),
+                          [](int ch) { return std::isspace(ch) == 0; })
+                 .base(),
+             std::end(*str));
 }
 
-static void trim(std::string &str) {
+static void trim(std::string *str) {
   trim_left(str);
   trim_right(str);
 }
@@ -60,19 +60,19 @@
 
   std::vector<std::string> display_order;
   std::istringstream str(display_order_buf.data());
-  for (std::string conn_name = ""; std::getline(str, conn_name, ',');) {
-    trim(conn_name);
+  for (std::string conn_name; std::getline(str, conn_name, ',');) {
+    trim(&conn_name);
     display_order.push_back(std::move(conn_name));
   }
   return display_order;
 }
 
 static std::vector<DrmConnector *> make_primary_display_candidates(
-    std::vector<std::unique_ptr<DrmConnector>> &connectors) {
+    const std::vector<std::unique_ptr<DrmConnector>> &connectors) {
   std::vector<DrmConnector *> primary_candidates;
   std::transform(std::begin(connectors), std::end(connectors),
                  std::back_inserter(primary_candidates),
-                 [](std::unique_ptr<DrmConnector> &conn) {
+                 [](const std::unique_ptr<DrmConnector> &conn) {
                    return conn.get();
                  });
   primary_candidates.erase(std::remove_if(std::begin(primary_candidates),
@@ -120,7 +120,7 @@
 
 std::tuple<int, int> DrmDevice::Init(const char *path, int num_displays) {
   /* TODO: Use drmOpenControl here instead */
-  fd_.Set(open(path, O_RDWR));
+  fd_.Set(open(path, O_RDWR | O_CLOEXEC));
   if (fd() < 0) {
     ALOGE("Failed to open dri %s: %s", path, strerror(errno));
     return std::make_tuple(-ENODEV, 0);
@@ -196,7 +196,7 @@
     }
 
     std::vector<DrmCrtc *> possible_crtcs;
-    DrmCrtc *current_crtc = NULL;
+    DrmCrtc *current_crtc = nullptr;
     for (auto &crtc : crtcs_) {
       if ((1 << crtc->pipe()) & e->possible_crtcs)
         possible_crtcs.push_back(crtc.get());
@@ -228,7 +228,7 @@
     }
 
     std::vector<DrmEncoder *> possible_encoders;
-    DrmEncoder *current_encoder = NULL;
+    DrmEncoder *current_encoder = nullptr;
     for (int j = 0; j < c->count_encoders; ++j) {
       for (auto &encoder : encoders_) {
         if (encoder->id() == c->encoders[j])
@@ -351,22 +351,22 @@
 }
 
 DrmConnector *DrmDevice::GetConnectorForDisplay(int display) const {
-  for (auto &conn : connectors_) {
+  for (const auto &conn : connectors_) {
     if (conn->display() == display)
       return conn.get();
   }
-  return NULL;
+  return nullptr;
 }
 
 DrmConnector *DrmDevice::GetWritebackConnectorForDisplay(int display) const {
-  for (auto &conn : writeback_connectors_) {
+  for (const auto &conn : writeback_connectors_) {
     if (conn->display() == display)
       return conn.get();
   }
-  return NULL;
+  return nullptr;
 }
 
-// TODO what happens when hotplugging
+// TODO(nobody): what happens when hotplugging
 DrmConnector *DrmDevice::AvailableWritebackConnector(int display) const {
   DrmConnector *writeback_conn = GetWritebackConnectorForDisplay(display);
   DrmConnector *display_conn = GetConnectorForDisplay(display);
@@ -377,7 +377,7 @@
     return writeback_conn;
 
   // Use another CRTC if available and doesn't have any connector
-  for (auto &crtc : crtcs_) {
+  for (const auto &crtc : crtcs_) {
     if (crtc->display() == display)
       continue;
     display_conn = GetConnectorForDisplay(crtc->display());
@@ -388,23 +388,23 @@
     if (writeback_conn)
       return writeback_conn;
   }
-  return NULL;
+  return nullptr;
 }
 
 DrmCrtc *DrmDevice::GetCrtcForDisplay(int display) const {
-  for (auto &crtc : crtcs_) {
+  for (const auto &crtc : crtcs_) {
     if (crtc->display() == display)
       return crtc.get();
   }
-  return NULL;
+  return nullptr;
 }
 
 DrmPlane *DrmDevice::GetPlane(uint32_t id) const {
-  for (auto &plane : planes_) {
+  for (const auto &plane : planes_) {
     if (plane->id() == id)
       return plane.get();
   }
-  return NULL;
+  return nullptr;
 }
 
 const std::vector<std::unique_ptr<DrmCrtc>> &DrmDevice::crtcs() const {
@@ -448,7 +448,9 @@
     int ret = TryEncoderForDisplay(display, connector->encoder());
     if (!ret) {
       return 0;
-    } else if (ret != -EAGAIN) {
+    }
+
+    if (ret != -EAGAIN) {
       ALOGE("Could not set mode %d/%d", display, ret);
       return ret;
     }
@@ -459,7 +461,9 @@
     if (!ret) {
       connector->set_encoder(enc);
       return 0;
-    } else if (ret != -EAGAIN) {
+    }
+
+    if (ret != -EAGAIN) {
       ALOGE("Could not set mode %d/%d", display, ret);
       return ret;
     }
@@ -472,7 +476,7 @@
 // Attach writeback connector to the CRTC linked to the display_conn
 int DrmDevice::AttachWriteback(DrmConnector *display_conn) {
   DrmCrtc *display_crtc = display_conn->encoder()->crtc();
-  if (GetWritebackConnectorForDisplay(display_crtc->display()) != NULL) {
+  if (GetWritebackConnectorForDisplay(display_crtc->display()) != nullptr) {
     ALOGE("Display already has writeback attach to it");
     return -EINVAL;
   }
@@ -498,7 +502,7 @@
 }
 
 int DrmDevice::CreatePropertyBlob(void *data, size_t length,
-                                  uint32_t *blob_id) {
+                                  uint32_t *blob_id) const {
   struct drm_mode_create_blob create_blob;
   memset(&create_blob, 0, sizeof(create_blob));
   create_blob.length = length;
@@ -513,7 +517,7 @@
   return 0;
 }
 
-int DrmDevice::DestroyPropertyBlob(uint32_t blob_id) {
+int DrmDevice::DestroyPropertyBlob(uint32_t blob_id) const {
   if (!blob_id)
     return 0;
 
@@ -533,7 +537,7 @@
 }
 
 int DrmDevice::GetProperty(uint32_t obj_id, uint32_t obj_type,
-                           const char *prop_name, DrmProperty *property) {
+                           const char *prop_name, DrmProperty *property) const {
   drmModeObjectPropertiesPtr props;
 
   props = drmModeObjectGetProperties(fd(), obj_id, obj_type);
@@ -573,8 +577,8 @@
                      property);
 }
 
-const std::string DrmDevice::GetName() const {
-  auto ver = drmGetVersion(fd_.get());
+std::string DrmDevice::GetName() const {
+  auto *ver = drmGetVersion(fd_.get());
   if (!ver) {
     ALOGW("Failed to get drm version for fd=%d", fd_.get());
     return "generic";
diff --git a/drm/DrmDevice.h b/drm/DrmDevice.h
index be68aa6..d8f347f 100644
--- a/drm/DrmDevice.h
+++ b/drm/DrmDevice.h
@@ -71,13 +71,13 @@
   int GetConnectorProperty(const DrmConnector &connector, const char *prop_name,
                            DrmProperty *property);
 
-  const std::string GetName() const;
+  std::string GetName() const;
 
   const std::vector<std::unique_ptr<DrmCrtc>> &crtcs() const;
   uint32_t next_mode_id();
 
-  int CreatePropertyBlob(void *data, size_t length, uint32_t *blob_id);
-  int DestroyPropertyBlob(uint32_t blob_id);
+  int CreatePropertyBlob(void *data, size_t length, uint32_t *blob_id) const;
+  int DestroyPropertyBlob(uint32_t blob_id) const;
   bool HandlesDisplay(int display) const;
   void RegisterHotplugHandler(DrmEventHandler *handler) {
     event_listener_.RegisterHotplugHandler(handler);
@@ -86,7 +86,7 @@
  private:
   int TryEncoderForDisplay(int display, DrmEncoder *enc);
   int GetProperty(uint32_t obj_id, uint32_t obj_type, const char *prop_name,
-                  DrmProperty *property);
+                  DrmProperty *property) const;
 
   int CreateDisplayPipe(DrmConnector *connector);
   int AttachWriteback(DrmConnector *display_conn);
diff --git a/drm/DrmEncoder.cpp b/drm/DrmEncoder.cpp
index bcf0926..ad05f88 100644
--- a/drm/DrmEncoder.cpp
+++ b/drm/DrmEncoder.cpp
@@ -16,19 +16,20 @@
 
 #include "DrmEncoder.h"
 
-#include <stdint.h>
 #include <xf86drmMode.h>
 
+#include <cstdint>
+
 #include "DrmDevice.h"
 
 namespace android {
 
 DrmEncoder::DrmEncoder(drmModeEncoderPtr e, DrmCrtc *current_crtc,
-                       const std::vector<DrmCrtc *> &possible_crtcs)
+                       std::vector<DrmCrtc *> possible_crtcs)
     : id_(e->encoder_id),
       crtc_(current_crtc),
       display_(-1),
-      possible_crtcs_(possible_crtcs) {
+      possible_crtcs_(std::move(possible_crtcs)) {
 }
 
 uint32_t DrmEncoder::id() const {
@@ -39,8 +40,8 @@
   return crtc_;
 }
 
-bool DrmEncoder::CanClone(DrmEncoder *possible_clone) {
-  return possible_clones_.find(possible_clone) != possible_clones_.end();
+bool DrmEncoder::CanClone(DrmEncoder *encoder) {
+  return possible_clones_.find(encoder) != possible_clones_.end();
 }
 
 void DrmEncoder::AddPossibleClone(DrmEncoder *possible_clone) {
diff --git a/drm/DrmEncoder.h b/drm/DrmEncoder.h
index f4464d0..4c01bc1 100644
--- a/drm/DrmEncoder.h
+++ b/drm/DrmEncoder.h
@@ -30,7 +30,7 @@
 class DrmEncoder {
  public:
   DrmEncoder(drmModeEncoderPtr e, DrmCrtc *current_crtc,
-             const std::vector<DrmCrtc *> &possible_crtcs);
+             std::vector<DrmCrtc *> possible_crtcs);
   DrmEncoder(const DrmEncoder &) = delete;
   DrmEncoder &operator=(const DrmEncoder &) = delete;
 
diff --git a/drm/DrmEventListener.cpp b/drm/DrmEventListener.cpp
index 6cfa37d..13a1273 100644
--- a/drm/DrmEventListener.cpp
+++ b/drm/DrmEventListener.cpp
@@ -18,12 +18,12 @@
 
 #include "DrmEventListener.h"
 
-#include <assert.h>
-#include <errno.h>
 #include <linux/netlink.h>
 #include <sys/socket.h>
 #include <xf86drm.h>
 
+#include <cassert>
+#include <cerrno>
 #include <cstring>
 
 #include "DrmDevice.h"
@@ -39,7 +39,8 @@
 }
 
 int DrmEventListener::Init() {
-  uevent_fd_.Set(socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT));
+  uevent_fd_.Set(
+      socket(PF_NETLINK, SOCK_DGRAM | SOCK_CLOEXEC, NETLINK_KOBJECT_UEVENT));
   if (uevent_fd_.get() < 0) {
     ALOGE("Failed to open uevent socket: %s", strerror(errno));
     return uevent_fd_.get();
@@ -57,6 +58,7 @@
     return -errno;
   }
 
+  // NOLINTNEXTLINE(readability-isolate-declaration)
   FD_ZERO(&fds_);
   FD_SET(drm_->fd(), &fds_);
   FD_SET(uevent_fd_.get(), &fds_);
@@ -73,7 +75,7 @@
 void DrmEventListener::FlipHandler(int /* fd */, unsigned int /* sequence */,
                                    unsigned int tv_sec, unsigned int tv_usec,
                                    void *user_data) {
-  DrmEventHandler *handler = (DrmEventHandler *)user_data;
+  auto *handler = (DrmEventHandler *)user_data;
   if (!handler)
     return;
 
@@ -86,6 +88,7 @@
   int ret;
 
   struct timespec ts;
+
   uint64_t timestamp = 0;
   ret = clock_gettime(CLOCK_MONOTONIC, &ts);
   if (!ret)
@@ -95,9 +98,10 @@
 
   while (true) {
     ret = read(uevent_fd_.get(), &buffer, sizeof(buffer));
-    if (ret == 0) {
+    if (ret == 0)
       return;
-    } else if (ret < 0) {
+
+    if (ret < 0) {
       ALOGE("Got error reading uevent %d", ret);
       return;
     }
@@ -105,12 +109,13 @@
     if (!hotplug_handler_)
       continue;
 
-    bool drm_event = false, hotplug_event = false;
-    for (int i = 0; i < ret;) {
+    bool drm_event = false;
+    bool hotplug_event = false;
+    for (uint32_t i = 0; i < ret;) {
       char *event = buffer + i;
-      if (strcmp(event, "DEVTYPE=drm_minor"))
+      if (strcmp(event, "DEVTYPE=drm_minor") != 0)
         drm_event = true;
-      else if (strcmp(event, "HOTPLUG=1"))
+      else if (strcmp(event, "HOTPLUG=1") != 0)
         hotplug_event = true;
 
       i += strlen(event) + 1;
@@ -124,13 +129,13 @@
 void DrmEventListener::Routine() {
   int ret;
   do {
-    ret = select(max_fd_ + 1, &fds_, NULL, NULL, NULL);
+    ret = select(max_fd_ + 1, &fds_, nullptr, nullptr, nullptr);
   } while (ret == -1 && errno == EINTR);
 
   if (FD_ISSET(drm_->fd(), &fds_)) {
     drmEventContext event_context =
         {.version = 2,
-         .vblank_handler = NULL,
+         .vblank_handler = nullptr,
          .page_flip_handler = DrmEventListener::FlipHandler};
     drmHandleEvent(drm_->fd(), &event_context);
   }
diff --git a/drm/DrmGenericImporter.cpp b/drm/DrmGenericImporter.cpp
index 171d889..6627cc8 100644
--- a/drm/DrmGenericImporter.cpp
+++ b/drm/DrmGenericImporter.cpp
@@ -21,11 +21,12 @@
 #include <cutils/properties.h>
 #include <gralloc_handle.h>
 #include <hardware/gralloc.h>
-#include <inttypes.h>
 #include <log/log.h>
 #include <xf86drm.h>
 #include <xf86drmMode.h>
 
+#include <cinttypes>
+
 namespace android {
 
 DrmGenericImporter::DrmGenericImporter(DrmDevice *drm) : drm_(drm) {
@@ -34,10 +35,7 @@
     ALOGE("drmGetCap failed. Fallback to no modifier support.");
     cap_value = 0;
   }
-  has_modifier_support_ = cap_value;
-}
-
-DrmGenericImporter::~DrmGenericImporter() {
+  has_modifier_support_ = cap_value != 0;
 }
 
 int DrmGenericImporter::ImportBuffer(hwc_drm_bo_t *bo) {
@@ -82,11 +80,11 @@
     return ret;
   }
 
-  for (int i = 0; i < HWC_DRM_BO_MAX_PLANES; i++) {
-    if (!bo->gem_handles[i])
+  for (unsigned int gem_handle : bo->gem_handles) {
+    if (!gem_handle)
       continue;
 
-    ImportHandle(bo->gem_handles[i]);
+    ImportHandle(gem_handle);
   }
 
   return ret;
@@ -97,14 +95,14 @@
     if (drmModeRmFB(drm_->fd(), bo->fb_id))
       ALOGE("Failed to rm fb");
 
-  for (int i = 0; i < HWC_DRM_BO_MAX_PLANES; i++) {
-    if (!bo->gem_handles[i])
+  for (unsigned int &gem_handle : bo->gem_handles) {
+    if (!gem_handle)
       continue;
 
-    if (ReleaseHandle(bo->gem_handles[i]))
-      ALOGE("Failed to release gem handle %d", bo->gem_handles[i]);
+    if (ReleaseHandle(gem_handle))
+      ALOGE("Failed to release gem handle %d", gem_handle);
     else
-      bo->gem_handles[i] = 0;
+      gem_handle = 0;
   }
   return 0;
 }
diff --git a/drm/DrmGenericImporter.h b/drm/DrmGenericImporter.h
index ca53762..27cfc3b 100644
--- a/drm/DrmGenericImporter.h
+++ b/drm/DrmGenericImporter.h
@@ -33,8 +33,7 @@
 
 class Importer {
  public:
-  virtual ~Importer() {
-  }
+  virtual ~Importer() = default;
 
   // Imports the buffer referred to by handle into bo.
   //
@@ -52,7 +51,7 @@
 class DrmGenericImporter : public Importer {
  public:
   DrmGenericImporter(DrmDevice *drm);
-  ~DrmGenericImporter() override;
+  ~DrmGenericImporter() override = default;
 
   int ImportBuffer(hwc_drm_bo_t *bo) override;
   int ReleaseBuffer(hwc_drm_bo_t *bo) override;
diff --git a/drm/DrmMode.cpp b/drm/DrmMode.cpp
index 6a879e8..dd25758 100644
--- a/drm/DrmMode.cpp
+++ b/drm/DrmMode.cpp
@@ -23,8 +23,7 @@
 namespace android {
 
 DrmMode::DrmMode(drmModeModeInfoPtr m)
-    : id_(0),
-      clock_(m->clock),
+    : clock_(m->clock),
       h_display_(m->hdisplay),
       h_sync_start_(m->hsync_start),
       h_sync_end_(m->hsync_end),
@@ -122,7 +121,7 @@
 
 float DrmMode::v_refresh() const {
   // Always recalculate refresh to report correct float rate
-  return clock_ / (float)(v_total_ * h_total_) * 1000.0f;
+  return clock_ / (float)(v_total_ * h_total_) * 1000.0F;
 }
 
 uint32_t DrmMode::flags() const {
diff --git a/drm/DrmPlane.cpp b/drm/DrmPlane.cpp
index 1cc6ee0..a7ad3c0 100644
--- a/drm/DrmPlane.cpp
+++ b/drm/DrmPlane.cpp
@@ -21,7 +21,9 @@
 #include <errno.h>
 #include <stdint.h>
 
+#include <cerrno>
 #include <cinttypes>
+#include <cstdint>
 
 #include "DrmDevice.h"
 #include "bufferinfo/BufferInfoGetter.h"
@@ -161,7 +163,7 @@
 }
 
 bool DrmPlane::GetCrtcSupported(const DrmCrtc &crtc) const {
-  return !!((1 << crtc.pipe()) & possible_crtc_mask_);
+  return ((1 << crtc.pipe()) & possible_crtc_mask_) != 0;
 }
 
 uint32_t DrmPlane::type() const {
diff --git a/drm/DrmProperty.cpp b/drm/DrmProperty.cpp
index b8ce680..4c5f44f 100644
--- a/drm/DrmProperty.cpp
+++ b/drm/DrmProperty.cpp
@@ -16,11 +16,10 @@
 
 #include "DrmProperty.h"
 
-#include <errno.h>
 #include <xf86drmMode.h>
 
+#include <cerrno>
 #include <cstdint>
-#include <cstring>
 #include <string>
 
 #include "DrmDevice.h"
@@ -31,11 +30,7 @@
     : value_(e->value), name_(e->name) {
 }
 
-DrmProperty::DrmPropertyEnum::~DrmPropertyEnum() {
-}
-
-DrmProperty::DrmProperty(drmModePropertyPtr p, uint64_t value)
-    : id_(0), type_(DRM_PROPERTY_TYPE_INVALID), flags_(0), name_("") {
+DrmProperty::DrmProperty(drmModePropertyPtr p, uint64_t value) {
   Init(p, value);
 }
 
@@ -46,13 +41,13 @@
   value_ = value;
 
   for (int i = 0; i < p->count_values; ++i)
-    values_.push_back(p->values[i]);
+    values_.emplace_back(p->values[i]);
 
   for (int i = 0; i < p->count_enums; ++i)
-    enums_.push_back(DrmPropertyEnum(&p->enums[i]));
+    enums_.emplace_back(DrmPropertyEnum(&p->enums[i]));
 
   for (int i = 0; i < p->count_blobs; ++i)
-    blob_ids_.push_back(p->blob_ids[i]);
+    blob_ids_.emplace_back(p->blob_ids[i]);
 
   if (flags_ & DRM_MODE_PROP_RANGE)
     type_ = DRM_PROPERTY_TYPE_INT;
@@ -76,7 +71,7 @@
   if (type_ == DRM_PROPERTY_TYPE_BLOB)
     return std::make_tuple(0, value_);
 
-  if (values_.size() == 0)
+  if (values_.empty())
     return std::make_tuple(-ENOENT, 0);
 
   switch (type_) {
@@ -108,7 +103,7 @@
 std::tuple<int, uint64_t> DrmProperty::range_min() const {
   if (!is_range())
     return std::make_tuple(-EINVAL, 0);
-  if (values_.size() < 1)
+  if (values_.empty())
     return std::make_tuple(-ENOENT, 0);
 
   return std::make_tuple(0, values_[0]);
@@ -124,9 +119,9 @@
 }
 
 std::tuple<uint64_t, int> DrmProperty::GetEnumValueWithName(
-    std::string name) const {
-  for (auto it : enums_) {
-    if (it.name_.compare(name) == 0) {
+    const std::string &name) const {
+  for (const auto &it : enums_) {
+    if (it.name_ == name) {
       return std::make_tuple(it.value_, 0);
     }
   }
diff --git a/drm/DrmProperty.h b/drm/DrmProperty.h
index d293da3..3f4d15e 100644
--- a/drm/DrmProperty.h
+++ b/drm/DrmProperty.h
@@ -41,7 +41,7 @@
   DrmProperty &operator=(const DrmProperty &) = delete;
 
   void Init(drmModePropertyPtr p, uint64_t value);
-  std::tuple<uint64_t, int> GetEnumValueWithName(std::string name) const;
+  std::tuple<uint64_t, int> GetEnumValueWithName(const std::string &name) const;
 
   uint32_t id() const;
   std::string name() const;
@@ -57,7 +57,7 @@
   class DrmPropertyEnum {
    public:
     DrmPropertyEnum(drm_mode_property_enum *e);
-    ~DrmPropertyEnum();
+    ~DrmPropertyEnum() = default;
 
     uint64_t value_;
     std::string name_;
diff --git a/drm/ResourceManager.cpp b/drm/ResourceManager.cpp
index efd5de1..3e16fbb 100644
--- a/drm/ResourceManager.cpp
+++ b/drm/ResourceManager.cpp
@@ -28,7 +28,7 @@
 
 namespace android {
 
-ResourceManager::ResourceManager() : num_displays_(0), gralloc_(NULL) {
+ResourceManager::ResourceManager() : num_displays_(0), gralloc_(nullptr) {
 }
 
 int ResourceManager::Init() {
@@ -47,11 +47,11 @@
       path << path_pattern << idx;
 
       struct stat buf;
-      if (stat(path.str().c_str(), &buf)) {
+      if (stat(path.str().c_str(), &buf))
         break;
-      } else if (IsKMSDev(path.str().c_str())) {
+
+      if (IsKMSDev(path.str().c_str()))
         ret = AddDrmDevice(path.str());
-      }
     }
   }
 
@@ -73,14 +73,15 @@
                        (const hw_module_t **)&gralloc_);
 }
 
-int ResourceManager::AddDrmDevice(std::string path) {
+int ResourceManager::AddDrmDevice(std::string const &path) {
   std::unique_ptr<DrmDevice> drm = std::make_unique<DrmDevice>();
-  int displays_added, ret;
+  int displays_added;
+  int ret;
   std::tie(ret, displays_added) = drm->Init(path.c_str(), num_displays_);
   if (ret)
     return ret;
   std::shared_ptr<Importer> importer;
-  importer.reset(new DrmGenericImporter(drm.get()));
+  importer = std::make_shared<DrmGenericImporter>(drm.get());
   if (!importer) {
     ALOGE("Failed to create importer instance");
     return -ENODEV;
@@ -93,7 +94,7 @@
 
 DrmConnector *ResourceManager::AvailableWritebackConnector(int display) {
   DrmDevice *drm_device = GetDrmDevice(display);
-  DrmConnector *writeback_conn = NULL;
+  DrmConnector *writeback_conn = nullptr;
   if (drm_device) {
     writeback_conn = drm_device->AvailableWritebackConnector(display);
     if (writeback_conn)
@@ -134,7 +135,7 @@
     if (drm->HandlesDisplay(display))
       return drm.get();
   }
-  return NULL;
+  return nullptr;
 }
 
 std::shared_ptr<Importer> ResourceManager::GetImporter(int display) {
@@ -142,7 +143,7 @@
     if (drms_[i]->HandlesDisplay(display))
       return importers_[i];
   }
-  return NULL;
+  return nullptr;
 }
 
 const gralloc_module_t *ResourceManager::gralloc() {
diff --git a/drm/ResourceManager.h b/drm/ResourceManager.h
index 7102cea..a17ae03 100644
--- a/drm/ResourceManager.h
+++ b/drm/ResourceManager.h
@@ -45,7 +45,7 @@
   }
 
  private:
-  int AddDrmDevice(std::string path);
+  int AddDrmDevice(std::string const &path);
   static bool IsKMSDev(const char *path);
 
   int num_displays_;
diff --git a/drm/VSyncWorker.cpp b/drm/VSyncWorker.cpp
index 7f8882d..8565aac 100644
--- a/drm/VSyncWorker.cpp
+++ b/drm/VSyncWorker.cpp
@@ -18,26 +18,24 @@
 
 #include "VSyncWorker.h"
 
-#include <stdlib.h>
-#include <time.h>
 #include <xf86drm.h>
 #include <xf86drmMode.h>
 
+#include <cstdlib>
+#include <ctime>
+
 #include "utils/log.h"
 
 namespace android {
 
 VSyncWorker::VSyncWorker()
     : Worker("vsync", HAL_PRIORITY_URGENT_DISPLAY),
-      drm_(NULL),
+      drm_(nullptr),
       display_(-1),
       enabled_(false),
       last_timestamp_(-1) {
 }
 
-VSyncWorker::~VSyncWorker() {
-}
-
 int VSyncWorker::Init(DrmDevice *drm, int display) {
   drm_ = drm;
   display_ = display;
@@ -47,7 +45,7 @@
 
 void VSyncWorker::RegisterCallback(std::shared_ptr<VsyncCallback> callback) {
   Lock();
-  callback_ = callback;
+  callback_ = std::move(callback);
   Unlock();
 }
 
@@ -81,7 +79,7 @@
  *  Thus, we must sleep until timestamp 687 to maintain phase with the last
  *  timestamp.
  */
-int64_t VSyncWorker::GetPhasedVSync(int64_t frame_ns, int64_t current) {
+int64_t VSyncWorker::GetPhasedVSync(int64_t frame_ns, int64_t current) const {
   if (last_timestamp_ < 0)
     return current + frame_ns;
 
@@ -95,21 +93,21 @@
   struct timespec vsync;
   int ret = clock_gettime(CLOCK_MONOTONIC, &vsync);
 
-  float refresh = 60.0f;  // Default to 60Hz refresh rate
+  float refresh = 60.0F;  // Default to 60Hz refresh rate
   DrmConnector *conn = drm_->GetConnectorForDisplay(display_);
-  if (conn && conn->active_mode().v_refresh() != 0.0f)
+  if (conn && conn->active_mode().v_refresh() != 0.0F)
     refresh = conn->active_mode().v_refresh();
   else
     ALOGW("Vsync worker active with conn=%p refresh=%f\n", conn,
-          conn ? conn->active_mode().v_refresh() : 0.0f);
+          conn ? conn->active_mode().v_refresh() : 0.0F);
 
   int64_t phased_timestamp = GetPhasedVSync(kOneSecondNs / refresh,
                                             vsync.tv_sec * kOneSecondNs +
                                                 vsync.tv_nsec);
   vsync.tv_sec = phased_timestamp / kOneSecondNs;
-  vsync.tv_nsec = phased_timestamp - (vsync.tv_sec * kOneSecondNs);
+  vsync.tv_nsec = int(phased_timestamp - (vsync.tv_sec * kOneSecondNs));
   do {
-    ret = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &vsync, NULL);
+    ret = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &vsync, nullptr);
   } while (ret == -1 && errno == EINTR);
   if (ret)
     return ret;
@@ -149,9 +147,10 @@
 
   int64_t timestamp;
   ret = drmWaitVBlank(drm_->fd(), &vblank);
-  if (ret == -EINTR) {
+  if (ret == -EINTR)
     return;
-  } else if (ret) {
+
+  if (ret) {
     ret = SyntheticWaitVBlank(&timestamp);
     if (ret)
       return;
diff --git a/drm/VSyncWorker.h b/drm/VSyncWorker.h
index 7454b51..76f2854 100644
--- a/drm/VSyncWorker.h
+++ b/drm/VSyncWorker.h
@@ -31,15 +31,14 @@
 
 class VsyncCallback {
  public:
-  virtual ~VsyncCallback() {
-  }
+  virtual ~VsyncCallback() = default;
   virtual void Callback(int display, int64_t timestamp) = 0;
 };
 
 class VSyncWorker : public Worker {
  public:
   VSyncWorker();
-  ~VSyncWorker() override;
+  ~VSyncWorker() override = default;
 
   int Init(DrmDevice *drm, int display);
   void RegisterCallback(std::shared_ptr<VsyncCallback> callback);
@@ -52,7 +51,7 @@
   void Routine() override;
 
  private:
-  int64_t GetPhasedVSync(int64_t frame_ns, int64_t current);
+  int64_t GetPhasedVSync(int64_t frame_ns, int64_t current) const;
   int SyntheticWaitVBlank(int64_t *timestamp);
 
   DrmDevice *drm_;
diff --git a/utils/Worker.cpp b/utils/Worker.cpp
index 1f30588..d2b60c8 100644
--- a/utils/Worker.cpp
+++ b/utils/Worker.cpp
@@ -34,8 +34,7 @@
   if (initialized())
     return -EALREADY;
 
-  thread_ = std::unique_ptr<std::thread>(
-      new std::thread(&Worker::InternalRoutine, this));
+  thread_ = std::make_unique<std::thread>(&Worker::InternalRoutine, this);
   initialized_ = true;
   exit_ = false;
 
diff --git a/utils/autolock.cpp b/utils/autolock.cpp
index 4e9552a..4b5cd7e 100644
--- a/utils/autolock.cpp
+++ b/utils/autolock.cpp
@@ -19,10 +19,10 @@
 
 #include "autolock.h"
 
-#include <errno.h>
+#include <log/log.h>
 #include <pthread.h>
 
-#include <log/log.h>
+#include <cerrno>
 
 namespace android {
 
diff --git a/utils/hwcutils.cpp b/utils/hwcutils.cpp
index 322efce..9a49c41 100644
--- a/utils/hwcutils.cpp
+++ b/utils/hwcutils.cpp
@@ -30,18 +30,18 @@
 namespace android {
 
 const hwc_drm_bo *DrmHwcBuffer::operator->() const {
-  if (importer_ == NULL) {
+  if (importer_ == nullptr) {
     ALOGE("Access of non-existent BO");
     exit(1);
-    return NULL;
+    return nullptr;
   }
   return &bo_;
 }
 
 void DrmHwcBuffer::Clear() {
-  if (importer_ != NULL) {
+  if (importer_ != nullptr) {
     importer_->ReleaseBuffer(&bo_);
-    importer_ = NULL;
+    importer_ = nullptr;
   }
 }
 
@@ -60,7 +60,7 @@
     return ret;
   }
 
-  if (importer_ != NULL) {
+  if (importer_ != nullptr) {
     importer_->ReleaseBuffer(&bo_);
   }
 
@@ -97,13 +97,13 @@
 }
 
 void DrmHwcNativeHandle::Clear() {
-  if (handle_ != NULL) {
+  if (handle_ != nullptr) {
     GraphicBufferMapper &gm(GraphicBufferMapper::get());
     int ret = gm.freeBuffer(handle_);
     if (ret) {
       ALOGE("Failed to free buffer handle %d", ret);
     }
-    handle_ = NULL;
+    handle_ = nullptr;
   }
 }
 
