From patchwork Mon Mar 21 13:19:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 8632671 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5815E9F372 for ; Mon, 21 Mar 2016 13:19:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6D591202F8 for ; Mon, 21 Mar 2016 13:19:43 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 83605202E5 for ; Mon, 21 Mar 2016 13:19:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3A83E6E173; Mon, 21 Mar 2016 13:19:37 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTP id 0E6676E173 for ; Mon, 21 Mar 2016 13:19:35 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP; 21 Mar 2016 06:19:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,372,1455004800"; d="scan'208";a="928575435" Received: from unknown (HELO localhost.isw.intel.com) ([10.237.224.39]) by fmsmga001.fm.intel.com with ESMTP; 21 Mar 2016 06:19:34 -0700 From: Matthew Auld To: intel-gfx@lists.freedesktop.org Date: Mon, 21 Mar 2016 13:19:24 +0000 Message-Id: <1458566364-31718-1-git-send-email-matthew.auld@intel.com> X-Mailer: git-send-email 2.4.3 Subject: [Intel-gfx] [PATCH] drm/i915: check for drm_universal_plane_init error X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Matthew Auld --- 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,