Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp439974iog; Mon, 13 Jun 2022 06:03:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9s9EnQRa6LnwrP9ju7Q4VGWZAbyGNauxBAd2Sm7yfCxmyDLMeWWcSaDJQaQeUT6qvV01q X-Received: by 2002:a05:6402:1e8b:b0:41c:59f6:2c26 with SMTP id f11-20020a0564021e8b00b0041c59f62c26mr65235366edf.156.1655125430550; Mon, 13 Jun 2022 06:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125430; cv=none; d=google.com; s=arc-20160816; b=fbLRnhvh6tgc2O2MNvFLGlpxWRDtQchkMCM+WuRFofyG0GFh/H1TtSMbmUi0i34UmL /LEDBV7O6AT6Hdr/msDxPDuhEWZChDbi6F0nsn1aikjIDA5EJledIPBYABZ9Vd0DETUm BgaaROxyTgP5omEKhmO5D9aO2VGS4MMPdk/VkJQxDMaErgLWWdI8GUlSad2Q601GsWMR e3lnKITFlDrJo8HGDRwHuKa46Se0i9U2gNKnWVEG4HQS9cSM3TAB5uKv14ReA53fgjbJ 0Wnw1sX9CFlvVB2gT92NToDgz8zBF1ElaZ6Fy07kKLpK7vrtAXbeH5XiWiTrVW0WrvPI IcMw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MoWNJKscgY+ym6WDZg5MKV73ECAqGzof6+l1AX6J6LM=; b=PJ4YnDKjgOAXPUwDUkrWhmXmfx1TPUnx5FnDCzJGOs00xL1E81LhuPU2rEN39w16Qe CykhfgGnCbhsAeA9zq6Hxr68ugS+utCQaXDOq5zSuLME06fjjOZDBqQ8OtSebs7Lgmy4 P19QZdZwFGry3qZ/yY5FcAyNAK8kkYgHi1EdrR+En2nKj3a5y8n4ohnhXIzdKd//kADW A/a0xvLnex1yKQD7Yas2/GSaCwlhaHqF9jOPuwMHCE2W5iQwMqtjodAaa3DleB7y05En YxZphstSQhQz4jukC/TFkMZI4nrjDbHf3RacPkpSM8Zxz/8+iHIjhXza8hSPQvPm3FY/ M0Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Lx4UdgT1; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bd1-20020a056402206100b0042b633ca6besi5907644edb.551.2022.06.13.06.03.25; Mon, 13 Jun 2022 06:03:50 -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=@linuxfoundation.org header.s=korg header.b=Lx4UdgT1; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350618AbiFMLBp (ORCPT + 99 others); Mon, 13 Jun 2022 07:01:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350277AbiFMKys (ORCPT ); Mon, 13 Jun 2022 06:54:48 -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 AAF6DF59B; Mon, 13 Jun 2022 03:30:42 -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 5A059B80E94; Mon, 13 Jun 2022 10:30:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AAABC34114; Mon, 13 Jun 2022 10:30:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655116240; bh=D52O2FRzILz9zMg8zYdxD18w6tiNZOOjolfGlqsqKWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lx4UdgT1a+mphQU6eNRUBhlunMLgn8/wrrXt/fZsLucoqion4AHLEFbHjdMI6tt1p 2hgpRRTZPuTad+lBZQhClijuWksIhl7CqZuAQlBX64axxC9VZflN22Qmvv44Tds4rV KH8G+M5kBrEnrLjLOESgMH11gEaC27p08aELeWvM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alice Wong , Alex Deucher , Sasha Levin Subject: [PATCH 5.4 040/411] drm/amdgpu/ucode: Remove firmware load type check in amdgpu_ucode_free_bo Date: Mon, 13 Jun 2022 12:05:13 +0200 Message-Id: <20220613094929.711769532@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 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