From patchwork Fri Jun 15 09:54:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Andrushchenko X-Patchwork-Id: 10465947 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E315F600F4 for ; Fri, 15 Jun 2018 09:54:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBF6E28D43 for ; Fri, 15 Jun 2018 09:54:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C080D28D49; Fri, 15 Jun 2018 09:54:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 71BFD28D43 for ; Fri, 15 Jun 2018 09:54:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 58BAA6E088; Fri, 15 Jun 2018 09:54:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id DB35A6E088 for ; Fri, 15 Jun 2018 09:54:20 +0000 (UTC) Received: by mail-lf0-x241.google.com with SMTP id j13-v6so13737330lfb.13 for ; Fri, 15 Jun 2018 02:54:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ue+8N8jMs6Lx6W/PV4IckKQIXpNf2ocGTfZxnN3lAYc=; b=WNgHeCzgGYXdP7m58GVOncsBSAvOZgOpz4/QxESum03mBLqrENVexKXagPNGvbDDbQ hGEt1B0fkWk4A0iHocD1rh1V38IxyleeaW4zj83b9imxKfwudOA+cR7mYm9bPpLYxxrr oaxsY1d0DFVN6Z72+Eo/sra48xYRxU0+/zUH+n83AixjCfppe4jeWoSgAKB/g5zZh8Te xksacknAZvIacSWLG7PM1expi9TiQsoNiYmQ3RMLsgM6O0koFpKfmC3lErlGO8uzhs5X cL7jZNN7ndV8ONmnLt0x6DacdfW5ygkAsakPEXVSnR1fNOuSNWqgcFBefRBy0OhvqjuB pkHw== X-Gm-Message-State: APt69E0E/ABTvvjHrMSI8eJRviLj85obCbJfJs+IIq0KidpZm2qZZYaS Ksm8SM+IlTQd8i+++tkrbvw= X-Google-Smtp-Source: ADUXVKILXg3hMsBfGqHRUmECqoUEXXmm/cyo9hwwUOWe3myV5YXjdZBEk1gHAlzmPlsHBwEvugFvRQ== X-Received: by 2002:a19:8e4e:: with SMTP id q75-v6mr772644lfd.95.1529056459227; Fri, 15 Jun 2018 02:54:19 -0700 (PDT) Received: from a2k-HP-ProDesk-600-G2-SFF.kyiv.epam.com (ll-74.141.223.85.sovam.net.ua. [85.223.141.74]) by smtp.gmail.com with ESMTPSA id 74-v6sm240914lfp.32.2018.06.15.02.54.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Jun 2018 02:54:18 -0700 (PDT) From: Oleksandr Andrushchenko To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, airlied@linux.ie, daniel.vetter@intel.com, seanpaul@chromium.org, gustavo@padovan.org, jgross@suse.com, boris.ostrovsky@oracle.com, dan.carpenter@oracle.com Subject: [PATCH] drm/xen-front: Replace NULL with error value in xen_drm_front_gem_get_sg_table Date: Fri, 15 Jun 2018 12:54:09 +0300 Message-Id: <20180615095409.5685-1-andr2000@gmail.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andr2000@gmail.com, Oleksandr Andrushchenko MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Oleksandr Andrushchenko Dan Carpenter has reported that there is the following static checker warning: drivers/gpu/drm/drm_prime.c:317 drm_gem_map_dma_buf() warn: 'sgt' can also be NULL 314 sgt = obj->dev->driver->gem_prime_get_sg_table(obj); 315 316 if (!IS_ERR(sgt)) { 317 if (!dma_map_sg_attrs(attach->dev, sgt->sgl, sgt->nents, dir, And one of the problematic functions is xen_drm_front_gem_get_sg_table. Fix this by replacing NULL with error value. Signed-off-by: Oleksandr Andrushchenko Reported-by: Dan Carpenter --- drivers/gpu/drm/xen/xen_drm_front_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c b/drivers/gpu/drm/xen/xen_drm_front_gem.c index c85bfe7571cb..47ff019d3aef 100644 --- a/drivers/gpu/drm/xen/xen_drm_front_gem.c +++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c @@ -179,7 +179,7 @@ struct sg_table *xen_drm_front_gem_get_sg_table(struct drm_gem_object *gem_obj) struct xen_gem_object *xen_obj = to_xen_gem_obj(gem_obj); if (!xen_obj->pages) - return NULL; + return ERR_PTR(-ENOMEM); return drm_prime_pages_to_sg(xen_obj->pages, xen_obj->num_pages); }