From patchwork Tue Nov 25 20:04:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Haixia Shi X-Patchwork-Id: 5382541 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 812B4C11AC for ; Tue, 25 Nov 2014 20:04:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E80C1201CD for ; Tue, 25 Nov 2014 20:04:39 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5DAA9201C7 for ; Tue, 25 Nov 2014 20:04:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 94C2E6E4D1; Tue, 25 Nov 2014 12:04:32 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ie0-f179.google.com (mail-ie0-f179.google.com [209.85.223.179]) by gabe.freedesktop.org (Postfix) with ESMTP id 2AD146E3F8 for ; Tue, 25 Nov 2014 12:04:32 -0800 (PST) Received: by mail-ie0-f179.google.com with SMTP id rp18so1299242iec.10 for ; Tue, 25 Nov 2014 12:04:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=8pJ3ulmY3omnDElktvnyDzi/5pBVhtSLy2ljEf1GW60=; b=Hc60g7rp+9SV/Ey4Jk2OMKZJhmo8M66ovLf3roZEx+KZpm7bt6/K9+tvJNE78LWk+e D35pNUrkdnGDKbVAN3oq84FCp9fH/iBfOK5HxVwLIsXaq4BeUyUsBBk4lIem5TGIxTz1 edjX/PyQLx08Yo75AoCd/584PD+gDR4teSusM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=8pJ3ulmY3omnDElktvnyDzi/5pBVhtSLy2ljEf1GW60=; b=Vt/fCYjeH6sUIj3Y0ES4rdoCkh1XtnNSbhMVHqzgJkcq7xtETWR67eTgGfb0GrwQR/ RAdGzBPnRaK0XEyz5/4CTzTfv8Yftuvs403Ulu+AAMWhwaUqtymNGBczf6IxzetvdntN vO82vg7AHA+eKy/mHKUcytOwLlwxGL5tmWjBZqO6aBG3zNwGLoGacVH9a2Bl4AhoulkV 3jGVoWZi0E4Y1eJYXuuRAMwUpkQA5kzGvhXQWVDI6TGXutwwWGMl/Ac5G9QZmXBJsJ1X WbTv53eRMhOm0uUNTeBuk+jve0r1uL8HgFa9ccywY+PzIaTZQLO4fpm1S5zyjo6nNWCp fV4Q== X-Gm-Message-State: ALoCoQnmfSQbxFg7dluojV/S5QNkAa/eOviE/Hwa9NY1Hu8rUPX5HT9Cj/1C411Zc99C2djAqjcD X-Received: by 10.107.133.17 with SMTP id h17mr25479378iod.47.1416945871913; Tue, 25 Nov 2014 12:04:31 -0800 (PST) Received: from localhost ([2620:0:1000:1600:21b6:de1c:1714:f317]) by mx.google.com with ESMTPSA id k191sm1053508iok.1.2014.11.25.12.04.30 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 25 Nov 2014 12:04:31 -0800 (PST) From: Haixia Shi To: dri-devel@lists.freedesktop.org, dan.carpenter@oracle.com Subject: [PATCH 2/2] drm/udl: properly check for error pointers Date: Tue, 25 Nov 2014 12:04:03 -0800 Message-Id: <1416945843-19569-2-git-send-email-hshi@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1416945843-19569-1-git-send-email-hshi@chromium.org> References: <1416945843-19569-1-git-send-email-hshi@chromium.org> MIME-Version: 1.0 Cc: airlied@redhat.com, Haixia Shi X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_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 The drm_prime_pages_to_sg() function never returns NULL pointers, only error pointers and valid pointers. Signed-off-by: Haixia Shi Reviewed-by: Stéphane Marchesin --- drivers/gpu/drm/udl/udl_dmabuf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/udl/udl_dmabuf.c b/drivers/gpu/drm/udl/udl_dmabuf.c index 2425b76..ac8a66b 100644 --- a/drivers/gpu/drm/udl/udl_dmabuf.c +++ b/drivers/gpu/drm/udl/udl_dmabuf.c @@ -99,9 +99,9 @@ static struct sg_table *udl_map_dma_buf(struct dma_buf_attachment *attach, page_count = obj->base.size / PAGE_SIZE; obj->sg = drm_prime_pages_to_sg(obj->pages, page_count); - if (!obj->sg) { - DRM_ERROR("sg is null.\n"); - return ERR_PTR(-ENOMEM); + if (IS_ERR(obj->sg)) { + DRM_ERROR("failed to allocate sgt.\n"); + return ERR_CAST(obj->sg); } sgt = &udl_attach->sgt;