Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1330069imw; Tue, 5 Jul 2022 07:40:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tWrVoFQgsumN6WWgkQZQtGCZER79ZvIq833fPgsiG04vdESRd8WqtBfr/ShH6OPK81To1h X-Received: by 2002:a63:d554:0:b0:40d:86ec:626b with SMTP id v20-20020a63d554000000b0040d86ec626bmr29584569pgi.530.1657032003390; Tue, 05 Jul 2022 07:40:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657032003; cv=none; d=google.com; s=arc-20160816; b=iDbNtdGeIFYPSKq2CYHl4JcBbIWVkPjTOrMOKx5WmvmZqCPuWibC9HYcoLtKRWx0Ln cdNRCQuB28MrlFU97xHe6ZmDIHlvkYFDDFLTjDECO8GwX0UFqvlixbzs0Hh91xiSztPG 3lNoW2TITdTU+4uMPYQoyMMPwR/VWMRqNDFfZd/CYYoUVdNlfAOFc9sWALngx5IHibTe rcdLun1f6yoyNKiJ4y9PsTRRgGkKcTfPLmnEOxzpwyUD6DEYY9YiUsSZnAsSGxY0fhCW khjbZkmvIYG43P6mD0/7/kpSEXqLeAm6/YLVymp26w+cYviccGkZZuCdoCgndOhWHeuV fqYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=InYC8SXGCUr2SbxJw+eNF1Llgvx8IFbTt02Np0AXcRM=; b=XekpTuFCtqAnNH6SWGNsHR6obB1S1ITbbhUiucPSQJq+bG6EgCwksH+SUWYq9sp7GS ltzKKA65wscxkyYp83JIwSvXGkcCA/52X93FY5BGXJnObZEdf1o5of8uQ9rWeYK26Umq fgl7N/7hugAOHI8fshe7/FEN+ah7rLPZgATEHfqtaUWbud+OUGtFJopnuy0qi8TShiSU w4vhwvuTzZVnQBmwEKkzirbAepwK/TnF6ZiL0Y5+FOFhfdTh9brUa+4qHlJbos6wqC7t jMg57+Rp9/47oW/GnmDsQMLJaPOEgVk8SV+DUv+mrD0/bvL80MafW4r0zlU9GAPbM/AW fyjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=hYQrstqf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020a656c12000000b0040ce4de349csi48926877pgu.291.2022.07.05.07.39.51; Tue, 05 Jul 2022 07:40:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=hYQrstqf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231624AbiGEOBg (ORCPT + 99 others); Tue, 5 Jul 2022 10:01:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231208AbiGEOBV (ORCPT ); Tue, 5 Jul 2022 10:01:21 -0400 Received: from mail-m971.mail.163.com (mail-m971.mail.163.com [123.126.97.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 031C820F6A for ; Tue, 5 Jul 2022 06:46:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=InYC8 SXGCUr2SbxJw+eNF1Llgvx8IFbTt02Np0AXcRM=; b=hYQrstqfPF4JRb4R0SFN8 jS4VvImduc1Bo97gYtxIVti+8UltclstQHX0Gp5Hm6UuV58UrUdCmyPgWCMQPWug TJ5JrkjCFm5Qv1nVjSarCp7sudfiw4UEnmiGYs+wtf7jLMgsLsOShN1Lz60V9RHL xCIUi4iG0anD41SCDaNDCw= Received: from localhost.localdomain (unknown [123.112.69.106]) by smtp1 (Coremail) with SMTP id GdxpCgA3TqGcQMRiNFCtMg--.33524S4; Tue, 05 Jul 2022 21:46:11 +0800 (CST) From: Jianglei Nie To: alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@linux.ie, daniel@ffwll.ch, Jack.Xiao@amd.com, Hawking.Zhang@amd.com, mukul.joshi@amd.com Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jianglei Nie Subject: [PATCH] drm/amdgpu/mes: Fix an error handling path in amdgpu_mes_self_test() Date: Tue, 5 Jul 2022 21:46:03 +0800 Message-Id: <20220705134603.2248455-1-niejianglei2021@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: GdxpCgA3TqGcQMRiNFCtMg--.33524S4 X-Coremail-Antispam: 1Uf129KBjvJXoW7Cw4DKr1UKw47Kr1kWFWDCFg_yoW8JF4xpF yfJFsrtry8ZF4jya4UCa4UZas8tw1xX3WUKF4F934S93s8KF98Gwn5tF1xAa4DKFZ8uFZx Jr97X34xZF1q9F7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zRIPfLUUUUU= X-Originating-IP: [123.112.69.106] X-CM-SenderInfo: xqlhyxxdqjzvrlsqjii6rwjhhfrp/1tbiFQM1jF5mLp8E1AAAs2 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org if amdgpu_mes_ctx_alloc_meta_data() fails, we should call amdgpu_vm_fini() to handle amdgpu_vm_init(). Add a new lable before amdgpu_vm_init() and goto this lable when amdgpu_mes_ctx_alloc_meta_data() fails. Signed-off-by: Jianglei Nie --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c index 69a70a0aaed9..7c196b8ac49f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c @@ -1157,7 +1157,7 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev) r = amdgpu_mes_ctx_alloc_meta_data(adev, &ctx_data); if (r) { DRM_ERROR("failed to alloc ctx meta data\n"); - goto error_pasid; + goto error_fini; } ctx_data.meta_data_gpu_addr = AMDGPU_VA_RESERVED_SIZE; @@ -1215,6 +1215,8 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev) BUG_ON(amdgpu_bo_reserve(ctx_data.meta_data_obj, true)); amdgpu_vm_bo_del(adev, ctx_data.meta_data_va); amdgpu_bo_unreserve(ctx_data.meta_data_obj); + +error_fini: amdgpu_vm_fini(adev, vm); error_pasid: -- 2.25.1