From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 673A0C001E0 for ; Tue, 1 Aug 2023 09:27:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231927AbjHAJ1r (ORCPT ); Tue, 1 Aug 2023 05:27:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232846AbjHAJ1X (ORCPT ); Tue, 1 Aug 2023 05:27:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C14D84208 for ; Tue, 1 Aug 2023 02:26:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DF256614F5 for ; Tue, 1 Aug 2023 09:26:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECA0AC433C8; Tue, 1 Aug 2023 09:26:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1690881973; bh=EcqhSCjgIROBiFLPRFCf18cataeVuyiG4n5wDIhvlLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oVBRM1PQFME2MaRe7K8TZldmdSJUa0glkNwAKmYK3PYEyWw6mfy9EV+kUkQXt+CFy pcfqXNOa5enFEFQ7SDCvM45d20cVIIxk/n729JNytmQBZhaOMJThdvEuPmEo3ULUZM SCEb7kMWqd3BPrGiWM0/zi3EmHelNNQkwIrx6L6M= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mario Limonciello , Lijo Lazar , Alex Deucher , Sasha Levin Subject: [PATCH 5.15 096/155] drm/amd: Fix an error handling mistake in psp_sw_init() Date: Tue, 1 Aug 2023 11:20:08 +0200 Message-ID: <20230801091913.631606534@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801091910.165050260@linuxfoundation.org> References: <20230801091910.165050260@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mario Limonciello [ Upstream commit c01aebeef3ce45f696ffa0a1303cea9b34babb45 ] If the second call to amdgpu_bo_create_kernel() fails, the memory allocated from the first call should be cleared. If the third call fails, the memory from the second call should be cleared. Fixes: b95b5391684b ("drm/amdgpu/psp: move PSP memory alloc from hw_init to sw_init") Signed-off-by: Mario Limonciello Reviewed-by: Lijo Lazar Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index 65744c3bd3648..f305a0f8e9b9a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -341,11 +341,11 @@ static int psp_sw_init(void *handle) return 0; failed2: - amdgpu_bo_free_kernel(&psp->fw_pri_bo, - &psp->fw_pri_mc_addr, &psp->fw_pri_buf); -failed1: amdgpu_bo_free_kernel(&psp->fence_buf_bo, &psp->fence_buf_mc_addr, &psp->fence_buf); +failed1: + amdgpu_bo_free_kernel(&psp->fw_pri_bo, + &psp->fw_pri_mc_addr, &psp->fw_pri_buf); return ret; } -- 2.40.1