[Intel-gfx] SENT_UPSTREAM [IOTG] drm/i915: Add error handling to drm_plane_create_rotation_property call

Badiuzzaman Iskhandar badiuzzaman.azzarfan.bin.iskhandar at intel.com
Thu Sep 21 07:49:59 UTC 2017


In kernel 4.10, drm_plane_create_rotation_property is replaced by
drm_mode_create_rotation_property which returns int instead of struct.

Thus, it's possible for this function to return non 0 which the  caller must handle

Signed-off-by: Badiuzzaman Iskhandar <badiuzzaman.azzarfan.bin.iskhandar at intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 14 ++++++++++----
 drivers/gpu/drm/i915/intel_sprite.c  |  4 +++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3903754..cabc92d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -15388,10 +15388,13 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
 		supported_rotations = DRM_ROTATE_0;
 	}
 
-	if (INTEL_GEN(dev_priv) >= 4)
-		drm_plane_create_rotation_property(&primary->base,
+	if (INTEL_GEN(dev_priv) >= 4) {
+		ret = drm_plane_create_rotation_property(&primary->base,
 						   DRM_ROTATE_0,
 						   supported_rotations);
+        if (ret)
+            goto fail;
+    }
 
 	drm_plane_helper_add(&primary->base, &intel_plane_helper_funcs);
 
@@ -15537,11 +15540,14 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
 	if (ret)
 		goto fail;
 
-	if (INTEL_GEN(dev_priv) >= 4)
-		drm_plane_create_rotation_property(&cursor->base,
+	if (INTEL_GEN(dev_priv) >= 4) {
+		ret = drm_plane_create_rotation_property(&cursor->base,
 						   DRM_ROTATE_0,
 						   DRM_ROTATE_0 |
 						   DRM_ROTATE_180);
+        if (ret)
+            goto fail;
+    }
 
 	if (INTEL_GEN(dev_priv) >= 9)
 		state->scaler_id = -1;
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index b53bc57..5f0ac6f 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1141,9 +1141,11 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
 	if (ret)
 		goto fail;
 
-	drm_plane_create_rotation_property(&intel_plane->base,
+	ret = drm_plane_create_rotation_property(&intel_plane->base,
 					   DRM_ROTATE_0,
 					   supported_rotations);
+    if (ret)
+        goto fail;
 
 	drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs);
 
-- 
1.9.1



More information about the Intel-gfx mailing list