Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3543958imm; Sun, 17 Jun 2018 23:08:11 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK+1uQo5+jVJnpNmT8TEvApNsoY/wEbhgp9xG/eYDCElwhVTkBRRGvyBxmlEXg8ugB3XH1V X-Received: by 2002:a17:902:bb07:: with SMTP id l7-v6mr7475756pls.73.1529302091555; Sun, 17 Jun 2018 23:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529302091; cv=none; d=google.com; s=arc-20160816; b=MWHMKecwdMArnwGWla1Bw4EGJbKqMUyM4hsc+9ON5uCKeG53UpIb5luPhWjo25lc83 REq6Ir8kzcz2SduyoMtfyaBlLg5U8ILTDblKfBkzogq5ruAS3YodsEBNZkaV78SEpoGx Rix48W7Q0I8mjcIz5JThDzGI1XVj/C83VPTQBXE0lKSdG76G9Jq028QGR/AxpAEj7yxz ZW8EKBt/i/jBBnszMCbw2X1I53ErN2u7ZB/QHtWR3hiww9HqiJcl1aLYBH4lW8ilzsnS bEbjff0QBG2kCXxoxyJsuEipxjXQ6s7tDSoIKvg09EsXrJDW3ONOO2pvrxI2nYGc6yrA sRQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=TYdgGtAUZgdonklPmw9db3u5DotkG5GQ4FXvZy0fcaU=; b=jNMoY2xCnRL68MNm7EquEGBYezwwxCViotWdT/YF2l2kP2Nz3jpeL9Bq4yq6+Q5l9P /EGSHKgdFOJxVRE+/qen5l0hA3VGPrUvJTtS/jBzaG5xgMFBqbfaNfBRN03F6JpqC10M EfTeQyGIz215lqD8knQrSMxVaOSXeRTY/Fp9islCbGOBXxZxoUPUZ7Y1GEHaDlMievcq NNvHfWD/kdPjeYHkKyBeW1LUmdEhVSWq129HUmh576fOtbsZjoO3Y3qcz9TO+86p3k67 EFTO4cQSrNVS2qDA7BBYEEhNtxLeNwb+rRh0DqXxKkT6sp0UIpmyKsyB7o+uNqmc0fuU PxJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cIJh3ceo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11-v6si13750396plt.284.2018.06.17.23.07.57; Sun, 17 Jun 2018 23:08:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cIJh3ceo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754843AbeFRGHV (ORCPT + 99 others); Mon, 18 Jun 2018 02:07:21 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:45733 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754458AbeFRGHU (ORCPT ); Mon, 18 Jun 2018 02:07:20 -0400 Received: by mail-lf0-f67.google.com with SMTP id a13-v6so2654645lfk.12 for ; Sun, 17 Jun 2018 23:07:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=TYdgGtAUZgdonklPmw9db3u5DotkG5GQ4FXvZy0fcaU=; b=cIJh3ceoKKMPGqN6263C3kp2uHTO7pdHWpHVhIzQDVMxFqg4kMfu6QF2K8l6hdufvC h5hc36ScI59DU3Zv+qG+q8eNp+XaqO2+6gNtaf4CWT5j992hqu8m3T0OsdnzKPVo4OSo djTfK/zTPcrJKX0oWTJCv6sPOSW0vGSWTu+i8G/LuaM1QmFYh0K10yHj9BjkSKPJEzud LDBf+mMx5acu5yhA8ly0LgWiZFJIiBqBo0H0Qg1R62QvmY3+Ulj6BjTwvZaqEcmiGI1C CIDMD+SXTn5KE68qKKU4oubv8Gu2bboNqaqzaoGv4MS5nL+wIGHYWgycFmEfq7YZnY6R rzCQ== 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=TYdgGtAUZgdonklPmw9db3u5DotkG5GQ4FXvZy0fcaU=; b=KyCksot16GaHyGwMTaj0kkdNSDy+hmfJ9n6cHHwGqzC+olHql0S1oSdwEF4JkXELgT MOITH7b4ptaHLX1KUcSM9YHmgcVnk5PI6k1LIBfI4xhMbYOJlUcabvsucsl5pchKS3ir hvoYZU3S1RPcZIWq6x/CDl5EFTBsXsT4smgiHQtnDGff9EHDjNFPBydVNLmYQmGFkZDe vMHh2x/WPubnroSdDXJQ5F9iWFHh5nBcKI2qk2PQXYsDaq4oJgI/QejO+OxZzCfSzT5f UaxGCnTxBurPANYwALN3IQB60EEIlTox7ASRlYvfSClnRE9pKCNAigT7b6WCNLHZo+Cj ciKQ== X-Gm-Message-State: APt69E34X43hyiKdIS3iU17Ii3cngxl6iXtI+IKTg3zgb6mBXHVpxVmT 0jZ7CuejvyXCuSjSEvqhmNo= X-Received: by 2002:a19:f03:: with SMTP id e3-v6mr4137607lfi.83.1529302038711; Sun, 17 Jun 2018 23:07:18 -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 c74-v6sm2627134lfh.78.2018.06.17.23.07.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 17 Jun 2018 23:07:17 -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 Cc: andr2000@gmail.com, Oleksandr Andrushchenko Subject: [PATCH v2] drm: Replace NULL with error value in drm_prime_pages_to_sg Date: Mon, 18 Jun 2018 09:07:09 +0300 Message-Id: <20180618060709.14290-1-andr2000@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, Problematic functions are xen_drm_front_gem_get_sg_table and drm_gem_cma_prime_get_sg_table. Fix those by replacing NULL with error value. Signed-off-by: Oleksandr Andrushchenko Reported-by: Dan Carpenter --- drivers/gpu/drm/drm_gem_cma_helper.c | 2 +- drivers/gpu/drm/xen/xen_drm_front_gem.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c index 80a5115c3846..ce868ce288fb 100644 --- a/drivers/gpu/drm/drm_gem_cma_helper.c +++ b/drivers/gpu/drm/drm_gem_cma_helper.c @@ -436,7 +436,7 @@ struct sg_table *drm_gem_cma_prime_get_sg_table(struct drm_gem_object *obj) sgt = kzalloc(sizeof(*sgt), GFP_KERNEL); if (!sgt) - return NULL; + return ERR_PTR(-ENOMEM); ret = dma_get_sgtable(obj->dev->dev, sgt, cma_obj->vaddr, cma_obj->paddr, obj->size); 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); } -- 2.17.1