From patchwork Tue Mar 25 10:09:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?0JLQsNGC0L7RgNC+0L/QuNC9INCQ0L3QtNGA0LXQuQ==?= X-Patchwork-Id: 14028280 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 B085DC35FFC for ; Tue, 25 Mar 2025 10:09:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1902810E0A5; Tue, 25 Mar 2025 10:09:31 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=crpt.ru header.i=@crpt.ru header.b="RjGeU7e1"; dkim-atps=neutral Received: from mail.crpt.ru (mail.crpt.ru [91.236.205.1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1195A10E0A5 for ; Tue, 25 Mar 2025 10:09:26 +0000 (UTC) Received: from mail.crpt.ru ([192.168.60.4]) by mail.crpt.ru with ESMTP id 52PA9FXR017359-52PA9FXT017359 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=OK); Tue, 25 Mar 2025 13:09:15 +0300 Received: from EX2.crpt.local (192.168.60.4) by ex2.crpt.local (192.168.60.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44; Tue, 25 Mar 2025 13:09:16 +0300 Received: from EX2.crpt.local ([192.168.60.4]) by EX2.crpt.local ([192.168.60.4]) with mapi id 15.01.2507.044; Tue, 25 Mar 2025 13:09:16 +0300 From: =?utf-8?b?0JLQsNGC0L7RgNC+0L/QuNC9INCQ0L3QtNGA0LXQuQ==?= To: Felix Kuehling CC: =?utf-8?b?0JLQsNGC0L7RgNC+0L/QuNC9INCQ0L3QtNGA0LXQuQ==?= , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , David Airlie , Simona Vetter , "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , "lvc-project@linuxtesting.org" Subject: [PATCH] drm/amdkfd: Remove the redundant NULL check for the 'svms' object Thread-Topic: [PATCH] drm/amdkfd: Remove the redundant NULL check for the 'svms' object Thread-Index: AQHbnW33CeLhAJikwUeO11Tuz1gnSA== Date: Tue, 25 Mar 2025 10:09:15 +0000 Message-ID: <20250325100908.68325-1-a.vatoropin@crpt.ru> Accept-Language: ru-RU, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.200.60.21] x-kse-serverinfo: EX2.crpt.local, 9 x-kse-antivirus-interceptor-info: scan successful x-kse-antivirus-info: Clean, bases: 3/24/2025 10:00:00 PM x-kse-attachment-filter-triggered-rules: Clean x-kse-attachment-filter-triggered-filters: Clean x-kse-bulkmessagesfiltering-scan-result: protection disabled MIME-Version: 1.0 X-FEAS-Client-IP: 192.168.60.4 X-FE-Policy-ID: 2:4:0:SYSTEM DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; d=crpt.ru; s=crpt.ru; c=relaxed/relaxed; h=from:to:cc:subject:date:message-id:content-type:mime-version; bh=S8ZTcQtvS2V8JjQOpgLS5GBUFk1XIB89xcUDwVmVR60=; b=RjGeU7e15VmA3QoUPYBidpFwzm6fOZoMgccWwzeAXxPH+LRrdeMZmoIRzoGbqCZI7KIsAeuw7UqK R6c42I69wLyOZzeSXFiJuiYZRaIHcr+DiO0mxHVZnpzS0mMAf30T0C2MqjxFJ+4/HwQEc0HLJpKb OLBoPjiXkNy0zd4Wr5XuKGupkg3gpy1Tk5rvADmy3iuMmYLr08c2NoRiqossJLU2uEeHQ/n9qFfk WRn7hhzvisIvj/499sk8H2vSbh1friBeesyI3ubP+3DW0pJdqGnFKSebR4xHemCyaZguosOnstPi JKZN0yD1Btp5ReqwuQSquTWOdJSPBd0uOpiaqg== 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Andrey Vatoropin Static analysis shows that pointer "svms" cannot be NULL because it points to the object "struct svm_range_list". Remove the extra NULL check. It is meaningless and harms the readability of the code. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Andrey Vatoropin --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c index bd3e20d981e0..9f0c6b623176 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c @@ -4089,8 +4089,6 @@ int svm_range_get_info(struct kfd_process *p, uint32_t *num_svm_ranges, *svm_priv_data_size = 0; svms = &p->svms; - if (!svms) - return -EINVAL; mutex_lock(&svms->lock); list_for_each_entry(prange, &svms->list, list) { @@ -4149,8 +4147,6 @@ int kfd_criu_checkpoint_svm(struct kfd_process *p, struct mm_struct *mm; svms = &p->svms; - if (!svms) - return -EINVAL; mm = get_task_mm(p->lead_thread); if (!mm) {