From patchwork Wed Jun 26 01:42:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seung-Woo Kim X-Patchwork-Id: 2782101 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 220EEC0AB1 for ; Wed, 26 Jun 2013 01:42:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4F24E201E6 for ; Wed, 26 Jun 2013 01:42:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id BFCD8201D6 for ; Wed, 26 Jun 2013 01:42:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A1F13E62C0 for ; Tue, 25 Jun 2013 18:42:47 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id B90AAE62B4 for ; Tue, 25 Jun 2013 18:42:34 -0700 (PDT) Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MOZ00DGL8QXEV60@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 26 Jun 2013 10:42:33 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.113]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 20.C4.11618.8074AC15; Wed, 26 Jun 2013 10:42:32 +0900 (KST) X-AuditID: cbfee691-b7fef6d000002d62-66-51ca47083fdf Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id F6.9C.28381.8074AC15; Wed, 26 Jun 2013 10:42:32 +0900 (KST) Received: from localhost.localdomain ([10.90.8.56]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MOZ0064V8QTAX30@mmp1.samsung.com>; Wed, 26 Jun 2013 10:42:32 +0900 (KST) From: Seung-Woo Kim To: dri-devel@lists.freedesktop.org, airlied@linux.ie Subject: [PATCH] drm/gem: fix not to assign error value to gem name Date: Wed, 26 Jun 2013 10:42:39 +0900 Message-id: <1372210959-28602-1-git-send-email-sw0312.kim@samsung.com> X-Mailer: git-send-email 1.7.4.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsWyRsSkUJfD/VSgwYupOha9504yWVz5+p7N 4mzTG3aLGZNfslns3TmZ0YHVY/u3B6we97uPM3n0bVnFGMAcxWWTkpqTWZZapG+XwJWxq+M7 W8FU7orFOzuZGhgnc3YxcnJICJhItPUsZoawxSQu3FvP1sXIxSEksJRRYt/V3YwwRe1H9zBC JBYxSkxf1c4OkhASaGaSeLXPHcRmE9CR2L/kNyuILSJgKnH28jWwqcwC3hI7tt8DiwsLOEtM bj4FFmcRUJVY2n8bbAGvgJvEpPcf2CGWKUgsuPcW7AoJgedsEse6n7FDNAhIfJt8iKWLkQMo ISux6QDU1ZISB1fcYJnAKLiAkWEVo2hqQXJBcVJ6kalecWJucWleul5yfu4mRmBAnv73bOIO xvsHrA8xJgONm8gsJZqcDwzovJJ4Q2MzIwtTE1NjI3NLM9KElcR51VusA4UE0hNLUrNTUwtS i+KLSnNSiw8xMnFwSjUwmiesN5Xdlczor/b4Yp73q+S9bsev3Tpw1vDvE0XXBb887Rk3TVo2 88oRjjoPs81GP9LilP4JfP+emLii99uXsmj51iu31700eWLmPSfuoOWxl0c4z2tIHLpuKvM9 56vN3eon3UEdXyXX/eDT/eD2j5M9yVFV9vKeD01n7asfmU5oMVv0++omZiWW4oxEQy3mouJE AAVo5EVeAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrBIsWRmVeSWpSXmKPExsVy+t9jAV0O91OBBl3n1Sx6z51ksrjy9T2b xdmmN+wWMya/ZLPYu3MyowOrx/ZvD1g97ncfZ/Lo27KKMYA5qoHRJiM1MSW1SCE1Lzk/JTMv 3VbJOzjeOd7UzMBQ19DSwlxJIS8xN9VWycUnQNctMwdoqZJCWWJOKVAoILG4WEnfDtOE0BA3 XQuYxghd35AguB4jAzSQsIYxY1fHd7aCqdwVi3d2MjUwTubsYuTkkBAwkWg/uocRwhaTuHBv PVsXIxeHkMAiRonpq9rZQRJCAs1MEq/2uYPYbAI6EvuX/GYFsUUETCXOXr7GDGIzC3hL7Nh+ DywuLOAsMbn5FFicRUBVYmn/bbAFvAJuEpPef2CHWKYgseDeW7YJjNwLGBlWMYqmFiQXFCel 5xrqFSfmFpfmpesl5+duYgSH+zOpHYwrGywOMQpwMCrx8CpsPRkoxJpYVlyZe4hRgoNZSYQ3 /wZQiDclsbIqtSg/vqg0J7X4EGMy0PaJzFKiyfnAWMwriTc0NjEzsjQyN7QwMjYnTVhJnPdA q3WgkEB6YklqdmpqQWoRzBYmDk6pBsZ91R+XFEqGrft0mldjosupg0LlH/vyYr9+mlu3/9Gq Q8LNLl4P75UsZvRdedGf2fLtf8U99jU530qzHzkGvvj39yNLR+89u8v/2IxeHZbetrWY4fgl /vWczZsiPtpVvuvZO3PeCakN0cLORjqua6JrX6WkZrdrmR/3V17WMe3fMr4rDf+ZLicpsRRn JBpqMRcVJwIAaEgZ6bsCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: kyungmin.park@samsung.com, sw0312.kim@samsung.com, yj44.cho@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 X-Spam-Status: No, score=-5.5 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 From: YoungJun Cho If idr_alloc() is failed, obj->name can be error value. Also it cleans up duplicated flink processing code. Signed-off-by: YoungJun Cho Signed-off-by: Seung-Woo Kim Signed-off-by: Kyungmin Park Reviewed-by: Chris Wilson --- drivers/gpu/drm/drm_gem.c | 18 +++++++----------- 1 files changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index cf919e3..239ef30 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -453,25 +453,21 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data, spin_lock(&dev->object_name_lock); if (!obj->name) { ret = idr_alloc(&dev->object_name_idr, obj, 1, 0, GFP_NOWAIT); - obj->name = ret; - args->name = (uint64_t) obj->name; - spin_unlock(&dev->object_name_lock); - idr_preload_end(); - if (ret < 0) goto err; - ret = 0; + + obj->name = ret; /* Allocate a reference for the name table. */ drm_gem_object_reference(obj); - } else { - args->name = (uint64_t) obj->name; - spin_unlock(&dev->object_name_lock); - idr_preload_end(); - ret = 0; } + args->name = (uint64_t) obj->name; + ret = 0; + err: + spin_unlock(&dev->object_name_lock); + idr_preload_end(); drm_gem_object_unreference_unlocked(obj); return ret; }