Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1338315pxa; Sun, 2 Aug 2020 04:16:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCDNRGP1FERgAQazSwCknQ5Leuf6KktMWahSDLtC0t60RFenMUaA4arzCw7eK93D1XBrLi X-Received: by 2002:a17:906:841:: with SMTP id f1mr12381641ejd.158.1596366985495; Sun, 02 Aug 2020 04:16:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596366985; cv=none; d=google.com; s=arc-20160816; b=RUb63t4Hhg6RgBUswLx4LhO85FdUgcFMWcF0hCF0rmxuCSLKHvoKS1avhVnMwlcuHZ tH8SuBNgiqfmcbWrd62cBGHkAn5WZD0xqtjgfc1dlIVU1LokNoBA0JlcPF6HBZ1V8Qxv ZxousTL/AsumWX0F+gY/1Gnfpbo/KR+mQQx8bXuC7F8wOqpNN+R2zIWb6spMqLkIGD8V 5ENPm5vfAyZi7euyg20QeZvzzgGyoEnyF/ONfetUIWOqT1pl7hOm3kSg2tGezVBnBr5c lWCcLlIOo1NW6ynpjLHhuyzgNnAKFfSLja20w+zTD0xM0FTk7NHWopsx/azs/ldzS4eH dLyw== 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; bh=sVV3dio6qGZqAgJhCplkgCXw20BBai6nY4Eq5lybnDE=; b=amZUzKfamLOwjR53PKIPvXDfstHHb60bv/Zvt1f8j3xL0/Fs6ELcBMaUhKlVUnnYXS AoOmSZFJ5ixJgKNH6Jz1ABhwmSuWCZ/a4R8spbUQazVYsC90nsB88TEWEziuG7Xg2DsK KNNwiq4IsfHNkKZ+cfguUOmCs5f4vfVznvqq7TVvYCN5yJ5zN8/WTcpH4XXbnGA7/6s0 jql3LLiMbXa2AdmW6k9tsilxbHyfLQY5Zp79DMlLxZrEBacsNP7JP7Ds2LzZtW1p9OyX LQ2KeilcM3geR+sXLro0NQAnC7a32GvnwdqnoBQ+TR1VXzx0cHZ5wj8SiM4DlKZ5UCv7 /Glg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y19si8113871ejm.324.2020.08.02.04.16.03; Sun, 02 Aug 2020 04:16:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728246AbgHBLPp (ORCPT + 99 others); Sun, 2 Aug 2020 07:15:45 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:37088 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728211AbgHBLPl (ORCPT ); Sun, 2 Aug 2020 07:15:41 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04397;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---0U4T30D9_1596366934; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0U4T30D9_1596366934) by smtp.aliyun-inc.com(127.0.0.1); Sun, 02 Aug 2020 19:15:34 +0800 From: Tianjia Zhang To: jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, chris@chris-wilson.co.uk, matthew.auld@intel.com, tvrtko.ursulin@intel.com, mika.kuoppala@linux.intel.com, andi.shyti@intel.com Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, tianjia.zhang@alibaba.com Subject: [PATCH] drm/i915: Fix wrong return value Date: Sun, 2 Aug 2020 19:15:34 +0800 Message-Id: <20200802111534.5155-1-tianjia.zhang@linux.alibaba.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 In function i915_active_acquire_preallocate_barrier(), not all paths have the return value set correctly, and in case of memory allocation failure, a negative error code should be returned. Cc: Chris Wilson Signed-off-by: Tianjia Zhang --- drivers/gpu/drm/i915/i915_active.c | 4 ++-- drivers/gpu/drm/i915/selftests/i915_request.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c index d960d0be5bd2..cc017e3cc9c5 100644 --- a/drivers/gpu/drm/i915/i915_active.c +++ b/drivers/gpu/drm/i915/i915_active.c @@ -758,7 +758,7 @@ int i915_active_acquire_preallocate_barrier(struct i915_active *ref, intel_engine_mask_t tmp, mask = engine->mask; struct llist_node *first = NULL, *last = NULL; struct intel_gt *gt = engine->gt; - int err; + int err = 0; GEM_BUG_ON(i915_active_is_idle(ref)); @@ -782,7 +782,7 @@ int i915_active_acquire_preallocate_barrier(struct i915_active *ref, if (!node) { node = kmem_cache_alloc(global.slab_cache, GFP_KERNEL); if (!node) { - err = ENOMEM; + err = -ENOMEM; goto unwind; } diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c index 6014e8dfcbb1..dda801a87b8a 100644 --- a/drivers/gpu/drm/i915/selftests/i915_request.c +++ b/drivers/gpu/drm/i915/selftests/i915_request.c @@ -326,7 +326,7 @@ static int __igt_breadcrumbs_smoketest(void *arg) if (!wait) { i915_sw_fence_commit(submit); heap_fence_put(submit); - err = ENOMEM; + err = -ENOMEM; break; } -- 2.26.2