From patchwork Mon Jan 30 10:12:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 13120879 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 742A9C61DA4 for ; Mon, 30 Jan 2023 10:18:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9101D10E20F; Mon, 30 Jan 2023 10:17:59 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3323E10E0DA; Mon, 30 Jan 2023 10:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675073874; x=1706609874; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=+PvPGmMHglYpglm65+fEXIafAYFe0KTSgTBfts6EAEg=; b=idwph9ON6sI4dI/pQ8/hXlAlVsbvFvSoN9m02Bbs8ex41G9Z2Fqnw6A+ AIAXi5TVtuozSTtd8ZomPqYOGmtYiftBQlBk4MEKTB+c6ks3txl27LuFa yJxM9AG7jTFJ1Du7xlnN2bj7prNBeeTxxoaPtCPMWXvl03Ss419lLS9xG 4UoJIWYMnLhAkbRJOBgtElA1MFwSXD4kQvrRMxk+ZltA0HyMqjA1pSL9I F7CQdGQV8Q9sT35EQ7hSIZTDe2Rn7AwEnuGzNOZGbrUArhxcusKHo2XRN yPfKPvcCZFcfM+nbNonbVRtI9FmuLFd1qlAnp3pFVXoRKLd4Ph4SUvZPE Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10605"; a="328798963" X-IronPort-AV: E=Sophos;i="5.97,257,1669104000"; d="scan'208";a="328798963" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2023 02:17:12 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10605"; a="696350129" X-IronPort-AV: E=Sophos;i="5.97,257,1669104000"; d="scan'208";a="696350129" Received: from dscheepe-mobl2.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.252.1.159]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2023 02:14:14 -0800 From: Matthew Auld To: intel-gfx@lists.freedesktop.org Subject: [PATCH 1/6] drm/i915/ttm: fix sparse warning Date: Mon, 30 Jan 2023 10:12:25 +0000 Message-Id: <20230130101230.25347-1-matthew.auld@intel.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Christian_K=C3=B6nig?= , kernel test robot , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Sparse complains with: drivers/gpu/drm/i915/gem/i915_gem_ttm.c:1066:21: sparse: expected restricted vm_fault_t [assigned] [usertype] ret drivers/gpu/drm/i915/gem/i915_gem_ttm.c:1066:21: sparse: got int Fixes: 516198d317d8 ("drm/i915: audit bo->resource usage v3") Reported-by: kernel test robot Signed-off-by: Matthew Auld Cc: Christian König Reviewed-by: Andrzej Hajda Acked-by: Christian König for the i915 patches. --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c index 7420276827a5..4758f21c91e1 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c @@ -1067,11 +1067,12 @@ static vm_fault_t vm_fault_ttm(struct vm_fault *vmf) .interruptible = true, .no_wait_gpu = true, /* should be idle already */ }; + int err; GEM_BUG_ON(!bo->ttm || !(bo->ttm->page_flags & TTM_TT_FLAG_SWAPPED)); - ret = ttm_bo_validate(bo, i915_ttm_sys_placement(), &ctx); - if (ret) { + err = ttm_bo_validate(bo, i915_ttm_sys_placement(), &ctx); + if (err) { dma_resv_unlock(bo->base.resv); return VM_FAULT_SIGBUS; }