[Intel-gfx] [PATCH] drm/i915: check for drm_universal_plane_init error
Matthew Auld
matthew.auld at intel.com
Mon Mar 21 13:19:24 UTC 2016
Signed-off-by: Matthew Auld <matthew.auld at intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 74b0165..b728f36 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13965,6 +13965,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
struct intel_plane_state *state;
const uint32_t *intel_primary_formats;
unsigned int num_formats;
+ int ret;
primary = kzalloc(sizeof(*primary), GFP_KERNEL);
if (primary == NULL)
@@ -14016,10 +14017,14 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
primary->disable_plane = i9xx_disable_primary_plane;
}
- drm_universal_plane_init(dev, &primary->base, 0,
- &intel_plane_funcs,
- intel_primary_formats, num_formats,
- DRM_PLANE_TYPE_PRIMARY, NULL);
+ ret = drm_universal_plane_init(dev, &primary->base, 0,
+ &intel_plane_funcs,
+ intel_primary_formats, num_formats,
+ DRM_PLANE_TYPE_PRIMARY, NULL);
+ if (ret) {
+ kfree(primary);
+ return ERR_PTR(ret);
+ }
if (INTEL_INFO(dev)->gen >= 4)
intel_create_rotation_property(dev, primary);
@@ -14145,6 +14150,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
{
struct intel_plane *cursor;
struct intel_plane_state *state;
+ int ret;
cursor = kzalloc(sizeof(*cursor), GFP_KERNEL);
if (cursor == NULL)
@@ -14166,11 +14172,15 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
cursor->update_plane = intel_update_cursor_plane;
cursor->disable_plane = intel_disable_cursor_plane;
- drm_universal_plane_init(dev, &cursor->base, 0,
- &intel_plane_funcs,
- intel_cursor_formats,
- ARRAY_SIZE(intel_cursor_formats),
- DRM_PLANE_TYPE_CURSOR, NULL);
+ ret = drm_universal_plane_init(dev, &cursor->base, 0,
+ &intel_plane_funcs,
+ intel_cursor_formats,
+ ARRAY_SIZE(intel_cursor_formats),
+ DRM_PLANE_TYPE_CURSOR, NULL);
+ if (ret) {
+ kfree(cursor);
+ return ERR_PTR(ret);
+ }
if (INTEL_INFO(dev)->gen >= 4) {
if (!dev->mode_config.rotation_property)
@@ -14239,11 +14249,11 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
}
primary = intel_primary_plane_create(dev, pipe);
- if (!primary)
+ if (IS_ERR_OR_NULL(primary))
goto fail;
cursor = intel_cursor_plane_create(dev, pipe);
- if (!cursor)
+ if (IS_ERR_OR_NULL(cursor))
goto fail;
ret = drm_crtc_init_with_planes(dev, &intel_crtc->base, primary,
--
2.4.3
More information about the Intel-gfx
mailing list