drm_hwcomposer: Tidy-up DrmPlane class
This allow to throw away few lines from DrmDevice::Init() making it less
complicated.
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
diff --git a/drm/DrmDevice.cpp b/drm/DrmDevice.cpp
index 8245b78..1c8427c 100644
--- a/drm/DrmDevice.cpp
+++ b/drm/DrmDevice.cpp
@@ -305,25 +305,13 @@
}
for (uint32_t i = 0; i < plane_res->count_planes; ++i) {
- auto p = MakeDrmModePlaneUnique(fd(), plane_res->planes[i]);
- if (!p) {
- ALOGE("Failed to get plane %d", plane_res->planes[i]);
- ret = -ENODEV;
- break;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
+ auto plane = DrmPlane::CreateInstance(*this, plane_res->planes[i]);
+
+ if (plane) {
+ planes_.emplace_back(std::move(plane));
}
-
- std::unique_ptr<DrmPlane> plane(new DrmPlane(this, p.get()));
-
- ret = plane->Init();
- if (ret) {
- ALOGE("Init plane %d failed", plane_res->planes[i]);
- break;
- }
-
- planes_.emplace_back(std::move(plane));
}
- if (ret)
- return std::make_tuple(ret, 0);
for (auto &conn : connectors_) {
ret = CreateDisplayPipe(conn.get());