From patchwork Fri May 17 09:03:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2584151 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 8E393DF215 for ; Fri, 17 May 2013 18:33:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7FCA9E641B for ; Fri, 17 May 2013 11:33:18 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-bk0-f48.google.com (mail-bk0-f48.google.com [209.85.214.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 30198E6324 for ; Fri, 17 May 2013 02:03:53 -0700 (PDT) Received: by mail-bk0-f48.google.com with SMTP id jf3so2243159bkc.35 for ; Fri, 17 May 2013 02:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to:cc :content-type; bh=YdRLJmf6GB8KCMp81x71oNhPsd4PwT0g8tyAg27EVDE=; b=az2PFHJ1ogYERHz5G35/R6Ipenc76EkO25p70Z6H6sbrFr4ou9RWi8i6x9g/x9UP4D B7tN96cg3sO0C+FmQnE7f5/j9hAnL6IXhUt3DY8Esm76Lv3/BFks6Z3TG0anztfHeD1u l/Zr6fnrnRu0yb2cn+yF2FKyQxgKWzF9W1eQxLcF+IB4whs6OGoi2T40NXNGtWwPb0K+ E0mxTfW02nWzrzE+kzs2nruSU1tF+MVqqPITDBpUPu7M8azvVlcfXyqmSVz0N7bRW3UO 8Mpn8IdQ6pJXdkh/0j36VRFcupNCSW8LrKl9baih4sOLiiGZ3BcuAhS7xIvZhQZrXCW3 vI4w== MIME-Version: 1.0 X-Received: by 10.204.57.13 with SMTP id a13mr15420393bkh.63.1368781432324; Fri, 17 May 2013 02:03:52 -0700 (PDT) Received: by 10.205.115.143 with HTTP; Fri, 17 May 2013 02:03:52 -0700 (PDT) Date: Fri, 17 May 2013 17:03:52 +0800 Message-ID: Subject: [PATCH v2] drm/exynos: fix error return code exynos_drm_load() From: Wei Yongjun To: inki.dae@samsung.com, jy0922.shim@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, airlied@linux.ie X-Mailman-Approved-At: Fri, 17 May 2013 11:31:14 -0700 Cc: yongjun_wei@trendmicro.com.cn, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Wei Yongjun Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Change function exynos_plane_init() to return ERR_PTR(), so the caller can use the error code from it. Signed-off-by: Wei Yongjun --- v1 -> v2: change exynos_plane_init() to return ERR_PTR(). --- drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 83efc66..2770f4b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -282,7 +282,7 @@ struct drm_plane *exynos_plane_init(struct drm_device *dev, exynos_plane = kzalloc(sizeof(struct exynos_plane), GFP_KERNEL); if (!exynos_plane) { DRM_ERROR("failed to allocate plane\n"); - return NULL; + return ERR_PTR(-ENOMEM); } err = drm_plane_init(dev, &exynos_plane->base, possible_crtcs, @@ -291,7 +291,7 @@ struct drm_plane *exynos_plane_init(struct drm_device *dev, if (err) { DRM_ERROR("failed to initialize plane\n"); kfree(exynos_plane); - return NULL; + return ERR_PTR(err); } if (priv) diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index e8894bc..21d0675 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -345,9 +345,9 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr) exynos_crtc->pipe = nr; exynos_crtc->dpms = DRM_MODE_DPMS_OFF; exynos_crtc->plane = exynos_plane_init(dev, 1 << nr, true); - if (!exynos_crtc->plane) { + if (IS_ERR(exynos_crtc->plane)) { kfree(exynos_crtc); - return -ENOMEM; + return PTR_ERR(exynos_crtc->plane); } crtc = &exynos_crtc->drm_crtc; diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index ba6d995..44f1d50 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -91,8 +91,10 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) unsigned int possible_crtcs = (1 << MAX_CRTC) - 1; plane = exynos_plane_init(dev, possible_crtcs, false); - if (!plane) + if (IS_ERR(plane) { + ret = PTR_ERR(plane); goto err_release_iommu_mapping; + } } ret = drm_vblank_init(dev, MAX_CRTC);