Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5300255ioo; Wed, 1 Jun 2022 02:37:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyad0H/3+HyLSx1qRImDtPlcaou2nj3P3tHkEKZhTCOMFto9lKVz6S1FH1tAoFxM4ZSfK5x X-Received: by 2002:a17:902:7048:b0:161:debe:c3f7 with SMTP id h8-20020a170902704800b00161debec3f7mr62105419plt.121.1654076231785; Wed, 01 Jun 2022 02:37:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654076231; cv=none; d=google.com; s=arc-20160816; b=H8qEbGSYkJupKBisEAXs71PKY23gju4kXTvJkFloopoq8rHsn+o3DmdR8G+g2dBbkD FjWEEN2xhJWkikSeur3o0p9KJv7PVFJ6pOrnxTR/jgLGFenaticGKo0/xEkFN38WQyTE FEFqroG0si9X9Ko8EHrfuGheFOU+BW4UzlnAGOkhow+M9LeUX5LlpD9eReJj/uQwHNEM RkNrY+xcRbVLHEqrj7V9qGE4CuTK69+RdpDZWh0WfzvUd+1Vz4RvxAwo+XnqmOixPF8f qU3dbWUJFiSzcbgKsDywr39wNcAQ0K8z6r12gQx688Nz7B7D58INUuKBVlgqHloqN4pR 4c6A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MoWNJKscgY+ym6WDZg5MKV73ECAqGzof6+l1AX6J6LM=; b=iyIsXbeCVNKLeE5cKhQUDOeGfovQXlPDbsOobsaun3qAPC7fNYyRXh41wOLtwByBVK HtdkVMsND9Kn90VUzVQ9u3oLt3jXFb0NOpKVcQFXsVuAMCi3vlVirIxlgcAjiEAHGPQt 66PMKWJAp/id13owcFnLfKmTrQSemyB2B+d35E0Vlk1xkoVIQ8AVJK2tKMgzomp/GeSk XDAmLrs6KTFhp5ENZDNjaQYmwyuCoJ2vwaNAGswKICi9eEyR6a3iYP72vj+MkC3CFRDf FwcZ0sdz9uyC9AQfiQJLTPyGvDwD8QLv741/iXS1tkzB7gu7hRTLXsxPwumYwSvLCcxO 2Ujg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=apPL99rl; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e16-20020a637450000000b003fb04d0b55dsi1795038pgn.565.2022.06.01.02.37.00; Wed, 01 Jun 2022 02:37:11 -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=@kernel.org header.s=k20201202 header.b=apPL99rl; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242493AbiE3ObO (ORCPT + 99 others); Mon, 30 May 2022 10:31:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241906AbiE3OSK (ORCPT ); Mon, 30 May 2022 10:18:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 038179CCB4; Mon, 30 May 2022 06:48:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1E173B80DAA; Mon, 30 May 2022 13:48:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA643C3411C; Mon, 30 May 2022 13:48:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653918504; bh=D52O2FRzILz9zMg8zYdxD18w6tiNZOOjolfGlqsqKWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=apPL99rlBMcvTIYP9yrHyjGDYRgwpGyRbp+O92sdRWKP5JKRr69DuBfzPwkhtEutQ ruOWeE2HDvmcsxOJUiVAaPpTpK0UPLcJXlMRaFcxIWuxOEwuk4Em+TmHn+MXqe2hmu 8OLnjXnSIzZp3yJm9W6Lt0BwUj5yMwEO3P+RdHwoI3ZqZQt9ZOJWgrXJtFY6nklkdT IrszjMpuquS8/pRhhvjwaiD7xvrTQNYHAY7Rh5nmSH/7XP4rAeBv93vNYIKrvahiXg LYQx138qVxBm2iT9uCvGuerw852G6SyLpCjMatpNjq4Weh1YXHbpNfKUqfieIGAich 22zFcS5Eyj2PQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alice Wong , Alex Deucher , Sasha Levin , christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@linux.ie, daniel@ffwll.ch, Hawking.Zhang@amd.com, Likun.Gao@amd.com, john.clements@amd.com, candice.li@amd.com, lang.yu@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.4 31/55] drm/amdgpu/ucode: Remove firmware load type check in amdgpu_ucode_free_bo Date: Mon, 30 May 2022 09:46:37 -0400 Message-Id: <20220530134701.1935933-31-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220530134701.1935933-1-sashal@kernel.org> References: <20220530134701.1935933-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Alice Wong [ Upstream commit ab0cd4a9ae5b4679b714d8dbfedc0901fecdce9f ] When psp_hw_init failed, it will set the load_type to AMDGPU_FW_LOAD_DIRECT. During amdgpu_device_ip_fini, amdgpu_ucode_free_bo checks that load_type is AMDGPU_FW_LOAD_DIRECT and skips deallocating fw_buf causing memory leak. Remove load_type check in amdgpu_ucode_free_bo. Signed-off-by: Alice Wong Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c index 3a6115ad0196..f3250db7f9c2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c @@ -568,8 +568,7 @@ int amdgpu_ucode_create_bo(struct amdgpu_device *adev) void amdgpu_ucode_free_bo(struct amdgpu_device *adev) { - if (adev->firmware.load_type != AMDGPU_FW_LOAD_DIRECT) - amdgpu_bo_free_kernel(&adev->firmware.fw_buf, + amdgpu_bo_free_kernel(&adev->firmware.fw_buf, &adev->firmware.fw_buf_mc, &adev->firmware.fw_buf_ptr); } -- 2.35.1