From patchwork Wed May 27 03:20:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 6486851 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D028A9F38C for ; Wed, 27 May 2015 03:21:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1480D20703 for ; Wed, 27 May 2015 03:21:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2CD0F20700 for ; Wed, 27 May 2015 03:21:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1488C6E8E6; Tue, 26 May 2015 20:21:02 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qc0-f181.google.com (mail-qc0-f181.google.com [209.85.216.181]) by gabe.freedesktop.org (Postfix) with ESMTP id 8EB176E8D1 for ; Tue, 26 May 2015 20:20:55 -0700 (PDT) Received: by qchk10 with SMTP id k10so11375247qch.2 for ; Tue, 26 May 2015 20:20:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=wTFMUCzoZxJxS8DUoIboZMbaAepPchcI7m/PPT9l150=; b=aS6/WdSIv+4WzYC0kH4SotxNOGxZF0DLyzWttqrdi70TWFxOHb8FQT9viGQ6luFCta 9DcHPnUpR0AKKwifGQBzsEMEgG3eOulb2SG3otgVkG+e2lwrbKYcY4GEfE7i8ISE6uhh HPNI/VNmc7zRhp9eJQQllhqFqwBn7mmekMafPv/TqhIj2DA+CMjh6Mp8l3A2Ki7Iofy4 PUB/JylgdrWlbnEQaidx0oBdGHdFV09lm+WM0bvPEOIRIeuZS5A2mp5iP06vMdzVTFTc Ig1fpDEIMM+U02cGKfpvOr0Mi/DexSyqmQ1xST4jkkj1AH9cBLraSPke9y88F05OsfLC k+pg== X-Received: by 10.140.92.120 with SMTP id a111mr37026857qge.30.1432696855285; Tue, 26 May 2015 20:20:55 -0700 (PDT) Received: from localhost.localdomain (static-74-96-105-49.washdc.fios.verizon.net. [74.96.105.49]) by mx.google.com with ESMTPSA id 20sm9629127qhf.14.2015.05.26.20.20.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 May 2015 20:20:54 -0700 (PDT) From: Alex Deucher X-Google-Original-From: Alex Deucher To: dri-devel@lists.freedesktop.org Subject: [PATCH 64/88] drm/amdgpu: do necessary NULL check Date: Tue, 26 May 2015 23:20:03 -0400 Message-Id: <1432696827-3752-34-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1432696827-3752-1-git-send-email-alexander.deucher@amd.com> References: <1432696827-3752-1-git-send-email-alexander.deucher@amd.com> MIME-Version: 1.0 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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 From: Jammy Zhou Signed-off-by: Jammy Zhou Reviewed-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c index 855d56a..21accbd 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c @@ -101,6 +101,9 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, unsigned i; int r = 0; + if (resv == NULL) + return -EINVAL; + /* always sync to the exclusive fence */ f = reservation_object_get_excl(resv); fence = f ? to_amdgpu_fence(f) : NULL; @@ -116,12 +119,12 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, for (i = 0; i < flist->shared_count; ++i) { f = rcu_dereference_protected(flist->shared[i], reservation_object_held(resv)); - fence = to_amdgpu_fence(f); + fence = f ? to_amdgpu_fence(f) : NULL; if (fence && fence->ring->adev == adev) { if (fence->owner != owner || fence->owner == AMDGPU_FENCE_OWNER_UNDEFINED) amdgpu_sync_fence(sync, fence); - } else { + } else if (f) { r = fence_wait(f, true); if (r) break;