From patchwork Fri Dec 7 09:35:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 1849321 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 0494DDF2EE for ; Fri, 7 Dec 2012 09:37:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DD3D1E5EE9 for ; Fri, 7 Dec 2012 01:37:05 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by gabe.freedesktop.org (Postfix) with ESMTP id CD958E626C for ; Fri, 7 Dec 2012 01:35:41 -0800 (PST) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MEN00BKRMMADAT0@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 07 Dec 2012 18:35:18 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.46]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 14.BD.12699.658B1C05; Fri, 07 Dec 2012 18:35:18 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-45-50c1b8569dee Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id A3.BD.12699.658B1C05; Fri, 07 Dec 2012 18:35:18 +0900 (KST) Received: from daeinki-desktop.10.32.193.11 ([10.90.51.53]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MEN00HYFMMUX470@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 07 Dec 2012 18:35:18 +0900 (KST) From: Inki Dae To: airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH 2/2] drm/exynos: add exception codes to exynos_drm_fbdev_create() Date: Fri, 07 Dec 2012 18:35:17 +0900 Message-id: <1354872917-30452-1-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.7.4.1 DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKLMWRmVeSWpSXmKPExsVy+t8zPd2wHQcDDDYekLS48vU9mwOjx/3u 40wBjFFcNimpOZllqUX6dglcGU9ON7AUNPJXTNl1lq2B8SxPFyMnh4SAicS0A02sELaYxIV7 69m6GLk4hASWMUpcnruVGaboVPt3qMR0RomDd5exQDjrmSRab29lB6liE1CVmLjiPhuILSJg KtExaSkLiM0sUCixsOcpmC0sECxx/NZHMJsFqP7DlwlMIDavgIvEyz2vmCC2KUgsuPeWDaJG QOLb5ENA9RxAcVmJTQeYQfZKCGxhkzi8/T9UvaTEwRU3WCYwCi5gZFjFKJpakFxQnJSea6RX nJhbXJqXrpecn7uJERJW0jsYVzVYHGIU4GBU4uHVeHIgQIg1say4MvcQowQHs5IIb0ffwQAh 3pTEyqrUovz4otKc1OJDjD5Al0xklhJNzgeGfF5JvKGxgbGhoaWhmamlqQEOYSVx3maPlAAh gfTEktTs1NSC1CKYcUwcnFINjLbPu1pTjv61cOnUkA2Ysifs1lSrczOEN3Bv+Zj44GCR0tHM ew1XfO/P8E2cLrhbVSqrN3L5bf8tGZbnbxRaft7SfcVE65aeedSMWomwZqU3HDzq75rMnqpc Pfy0fXrkocue+3/fVZQxqF+t2m/A1pRtfZs5tLzD/OM/xWZdt5lbn9rV7nCNV2Ipzkg01GIu Kk4EAL5BishYAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrCLMWRmVeSWpSXmKPExsVy+t9jQd2wHQcDDKYeFra48vU9mwOjx/3u 40wBjFENjDYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbmSgp5ibmptkouPgG6bpk5 QGOVFMoSc0qBQgGJxcVK+naYJoSGuOlawDRG6PqGBMH1GBmggYR1jBlPTjewFDTyV0zZdZat gfEsTxcjJ4eEgInEqfbvbBC2mMSFe+uBbC4OIYHpjBIH7y5jgXDWM0m03t7KDlLFJqAqMXHF fbAOEQFTiY5JS1lAbGaBQomFPU/BbGGBYInjtz6C2SxA9R++TGACsXkFXCRe7nnFBLFNQWLB vbdsExi5FzAyrGIUTS1ILihOSs810itOzC0uzUvXS87P3cQIDtpn0jsYVzVYHGIU4GBU4uHV eHIgQIg1say4MvcQowQHs5IIb0ffwQAh3pTEyqrUovz4otKc1OJDjD5A2ycyS4km5wMjKq8k 3tDYxMzI0sjM2MTc2BiHsJI4b7NHSoCQQHpiSWp2ampBahHMOCYOTqkGxlwVXtadNgHt+88q GJZM3uvV3LBghoDvllubdjNPO9O3/Vzj3F3JqRO8Y/KZouJ5Ihr8LXKXeWuHW7Pcdnu28qeg 618j3t/CHlmWyvLHOKNDfhec6BQvEz7/tMh6S1Svbk+ZjKCTE8OHZJ0XTF0yhp3+4lkVrZLR 2mukC6N79MRMk37dy1FiKc5INNRiLipOBADpaYHIhwIAAA== X-CFilter-Loop: Reflected Cc: kyungmin.park@samsung.com, sw0312.kim@samsung.com 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: , MIME-Version: 1.0 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 This patch releases allocated resources correctly. Signed-off-by: Inki Dae Signed-off-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index a223279..885ef23 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -164,7 +164,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, exynos_gem_obj = exynos_drm_gem_create(dev, 0, size); if (IS_ERR(exynos_gem_obj)) { ret = PTR_ERR(exynos_gem_obj); - goto out; + goto err_release_framebuffer; } exynos_fbdev->exynos_gem_obj = exynos_gem_obj; @@ -174,7 +174,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, if (IS_ERR_OR_NULL(helper->fb)) { DRM_ERROR("failed to create drm framebuffer.\n"); ret = PTR_ERR(helper->fb); - goto out; + goto err_destroy_gem; } helper->fbdev = fbi; @@ -186,14 +186,24 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, ret = fb_alloc_cmap(&fbi->cmap, 256, 0); if (ret) { DRM_ERROR("failed to allocate cmap.\n"); - goto out; + goto err_destroy_framebuffer; } ret = exynos_drm_fbdev_update(helper, helper->fb); - if (ret < 0) { - fb_dealloc_cmap(&fbi->cmap); - goto out; - } + if (ret < 0) + goto err_dealloc_cmap; + + mutex_unlock(&dev->struct_mutex); + return ret; + +err_dealloc_cmap: + fb_dealloc_cmap(&fbi->cmap); +err_destroy_framebuffer: + drm_framebuffer_cleanup(helper->fb); +err_destroy_gem: + exynos_drm_gem_destroy(exynos_gem_obj); +err_release_framebuffer: + framebuffer_release(fbi); /* * if failed, all resources allocated above would be released by