From patchwork Mon Jun 24 07:40:53 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: 2768951 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 714319F3A0 for ; Mon, 24 Jun 2013 07:41:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4ADCC20103 for ; Mon, 24 Jun 2013 07:41:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7241B200FE for ; Mon, 24 Jun 2013 07:41:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 48749E5FD9 for ; Mon, 24 Jun 2013 00:41:10 -0700 (PDT) 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 87757E5DD4 for ; Mon, 24 Jun 2013 00:40:58 -0700 (PDT) Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MOV006F1ZZUI8V0@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 24 Jun 2013 16:40:46 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.115]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 35.75.03969.EF7F7C15; Mon, 24 Jun 2013 16:40:46 +0900 (KST) X-AuditID: cbfee68f-b7f436d000000f81-51-51c7f7fe907f Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 53.11.21068.EF7F7C15; Mon, 24 Jun 2013 16:40:46 +0900 (KST) Received: from localhost.localdomain ([10.90.8.56]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MOV00NCJZZV0C60@mmp2.samsung.com>; Mon, 24 Jun 2013 16:40:46 +0900 (KST) From: Seung-Woo Kim To: dri-devel@lists.freedesktop.org, airlied@linux.ie Subject: [PATCH] drm/prime: replace NULL with error value in drm_prime_pages_to_sg Date: Mon, 24 Jun 2013 16:40:53 +0900 Message-id: <1372059653-29624-1-git-send-email-sw0312.kim@samsung.com> X-Mailer: git-send-email 1.7.4.1 In-reply-to: <1372055661-22786-1-git-send-email-sw0312.kim@samsung.com> References: <1372055661-22786-1-git-send-email-sw0312.kim@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRmVeSWpSXmKPExsWyRsSkWPff9+OBBh92mVn0njvJZPFhqYvF la/v2SzONr1ht5gx+SWbxd6dkxkd2Dy2f3vA6nG/+ziTR2/zOzaPvi2rGANYorhsUlJzMstS i/TtErgyzr+vLujiqXizt4OpgbGFq4uRk0NCwERi29+ljBC2mMSFe+vZuhi5OIQEljJK7Nm4 hQWmaGfTTajEdEaJed+PgiWEBJqZJP48UgWx2QR0JPYv+c0KYosImEqcvXyNGcRmFkiWOPBg OXsXIweHsECIxJ/vISBhFgFViZtnOsAW8wq4Saw8tI0JYpeCxIJ7b9lAbE4Bd4mZMyYyQ6xy k3j7fjXUPd3sEjf2CEDMEZD4NvkQC8h4CQFZiU0HmCFKJCUOrrjBMoFReAEjwypG0dSC5ILi pPQiY73ixNzi0rx0veT83E2MwGA+/e9Z/w7GuwesDzEmA42byCwlmpwPjIa8knhDYzMjC1MT U2Mjc0sz0oSVxHnVWqwDhQTSE0tSs1NTC1KL4otKc1KLDzEycXBKN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TAQBTHqbaAgAA 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.3 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 Instead of NULL, error value is casted with ERR_PTR() for drm_prime_pages_to_sg() and IS_ERR_OR_NULL() macro is replaced with IS_ERR() macro for drm_gem_map_dma_buf(). Signed-off-by: YoungJun Cho Signed-off-by: Seung-Woo Kim Signed-off-by: Kyungmin Park --- drivers/gpu/drm/drm_prime.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index f1699e9..a47eab4 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -74,7 +74,7 @@ static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach, sgt = obj->dev->driver->gem_prime_get_sg_table(obj); - if (!IS_ERR_OR_NULL(sgt)) { + if (!IS_ERR(sgt)) { if (!dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir)) { sg_free_table(sgt); kfree(sgt); @@ -417,8 +417,10 @@ struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages) int ret; sg = kmalloc(sizeof(struct sg_table), GFP_KERNEL); - if (!sg) + if (!sg) { + ret = -ENOMEM; goto out; + } ret = sg_alloc_table_from_pages(sg, pages, nr_pages, 0, nr_pages << PAGE_SHIFT, GFP_KERNEL); @@ -428,7 +430,7 @@ struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages) return sg; out: kfree(sg); - return NULL; + return ERR_PTR(ret); } EXPORT_SYMBOL(drm_prime_pages_to_sg);