Minor cleanup in gralloc

Bug: 251042358
Test: presubmit
Change-Id: Id3e2314abb7ca9a004c594f6a480b17d83cb8997
Signed-off-by: Roman Kiryanov <rkir@google.com>
diff --git a/system/hals/allocator3.cpp b/system/hals/allocator3.cpp
index 3619d91..b968d7f 100644
--- a/system/hals/allocator3.cpp
+++ b/system/hals/allocator3.cpp
@@ -199,16 +199,14 @@
             emulatorFrameworkFormat = EmulatorFrameworkFormat::YUV_420_888;
             break;
 
-        default:
-            if (static_cast<android::hardware::graphics::common::V1_1::PixelFormat>(format) ==
-                    android::hardware::graphics::common::V1_1::PixelFormat::YCBCR_P010) {
-                yuv_format = true;
-                glFormat = GL_RGBA;
-                glType = GL_UNSIGNED_BYTE;
-                bpp = 2;
-                break;
-            }
+        case PixelFormat::YCBCR_P010:
+            yuv_format = true;
+            glFormat = GL_RGBA;
+            glType = GL_UNSIGNED_BYTE;
+            bpp = 2;
+            break;
 
+        default:
             ALOGE("%s:%d Unsupported format: format=%d, frameworkFormat=%d, usage=%x",
                   __func__, __LINE__, format, descriptor.format, usage);
             RETURN_ERROR(Error3::UNSUPPORTED);
diff --git a/system/hals/mapper3.cpp b/system/hals/mapper3.cpp
index 58c0f69..a14a0cd 100644
--- a/system/hals/mapper3.cpp
+++ b/system/hals/mapper3.cpp
@@ -351,17 +351,15 @@
             cStep = 1;
             break;
 
-        default:
-            if (static_cast<android::hardware::graphics::common::V1_1::PixelFormat>(cb->format) ==
-                    android::hardware::graphics::common::V1_1::PixelFormat::YCBCR_P010) {
-                yStride = cb->width * 2;
-                cStride = yStride;
-                uOffset = cb->height * yStride;
-                vOffset = uOffset + 2;
-                cStep = 4;
-                break;
-            }
+        case PixelFormat::YCBCR_P010:
+            yStride = cb->width * 2;
+            cStride = yStride;
+            uOffset = cb->height * yStride;
+            vOffset = uOffset + 2;
+            cStep = 4;
+            break;
 
+        default:
             ALOGE("%s:%d unexpected format (%d)", __func__, __LINE__, cb->format);
             RETURN_ERROR(Error3::BAD_BUFFER);
         }