From patchwork Sun Mar 8 09:26:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 11426173 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E63C013A4 for ; Mon, 9 Mar 2020 08:14:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id CEBC020728 for ; Mon, 9 Mar 2020 08:14:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CEBC020728 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=wanadoo.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3EE846E2D3; Mon, 9 Mar 2020 08:13:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.smtpout.orange.fr (smtp09.smtpout.orange.fr [80.12.242.131]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5DFE76E28A for ; Sun, 8 Mar 2020 09:26:47 +0000 (UTC) Received: from localhost.localdomain ([90.126.162.40]) by mwinf5d18 with ME id BlSf220010scBcy03lSf0d; Sun, 08 Mar 2020 10:26:44 +0100 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 08 Mar 2020 10:26:44 +0100 X-ME-IP: 90.126.162.40 From: Christophe JAILLET To: harry.wentland@amd.com, sunpeng.li@amd.com, alexander.deucher@amd.com, christian.koenig@amd.com, David1.Zhou@amd.com, airlied@linux.ie, daniel@ffwll.ch, nicholas.kazlauskas@amd.com, Bhawanpreet.Lakha@amd.com, mario.kleiner.de@gmail.com, David.Francis@amd.com Subject: [PATCH] drm/amdgpu/display: Fix an error handling path in 'dm_update_crtc_state()' Date: Sun, 8 Mar 2020 10:26:37 +0100 Message-Id: <20200308092637.8194-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 09 Mar 2020 08:13:37 +0000 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: , Cc: Christophe JAILLET , kernel-janitors@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 'dc_stream_release()' may be called twice. Once here, and once below in the error handling path if we branch to the 'fail' label. Set 'new_stream' to NULL, once released to avoid the duplicated release function call. Signed-off-by: Christophe JAILLET --- Maybe the 'goto fail' at line 7745 should be turned into a 'return ret' instead. Could be clearer. No Fixes tag provided because I've not been able to dig deep enough in the git history. --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 97c1b01c0fc1..9d7773a77c4f 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -7704,8 +7704,10 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, skip_modeset: /* Release extra reference */ - if (new_stream) - dc_stream_release(new_stream); + if (new_stream) { + dc_stream_release(new_stream); + new_stream = NULL; + } /* * We want to do dc stream updates that do not require a