Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1064031ybl; Wed, 14 Aug 2019 10:07:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJnOJxX55QmkNS8frHirK85ojLwL+NPdCMiE+fcaEvIdPhr/8ioZPGay1YINKG0Q8PXpJS X-Received: by 2002:a62:87c8:: with SMTP id i191mr952903pfe.133.1565802474024; Wed, 14 Aug 2019 10:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802474; cv=none; d=google.com; s=arc-20160816; b=pzE8lGbYD6HjWqNWgfEQ3pN7tRiNB2GKu+XtIY1gJww3rE0G7k2nEADqOAbVwz8nwu sLSJ1RLgYyO3Fy21TFLF91yUURwkowg3u1Hl9MGJbniH8TYt+qJwJUH7z2i6T5uyKblD OKMS8nL88hExr4AAhALpPfMcQehhGnfGZhbfHQkK9Igqci5AB90cv5LnefjpPNfYfOmY FpexNNbb+6xoBQEMvWiRM6/JsgPM62FstGUSfAAdw9IiKMl7WinTlZOYT/FK6OhWS5k7 /Rtc+Yn9Ju7t7mwZJYy+eRP6RHS7H5ftMF4P4kL/icXgT/UwgLjDLVz2C2W/H8iROViK 8uCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sMrC/CmuD+DTUjba74BDD3BtP2ap8Pa7FGYPsN2s5z0=; b=TRrWo2HcXvsDJRkGU4IheWNnAzmwwfEygS6zP80B/XPEc54Uv0qKBpJvkuMIYTi5eh DVrCUcoOflOKLqPgvGpsb3UQsfCFi0n11jw8X1xJF0vORcpApnLpD5D4eUuRM8ipvYvf 1hRzBn35l3hH6xfoDYFckfZOt/4aUgL1X/HoZWGSPBBAhOu5xsRRGYAnFxOhuvA+HrnZ oEwOeBbJTfJCUxHMirad75X5rth+79+xe3hmVYqbXkV2mEM00wvzKAWtwH5k1l2lOSrY 4lMb8fHREE/DI+Nkwg+JFYlFtB4KU9Gg8X371tGYKrb9HPNIqcjp2F03IMOO94n83ClR o2Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oBmuKp3b; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h7si183469pgc.130.2019.08.14.10.07.37; Wed, 14 Aug 2019 10:07:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oBmuKp3b; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728792AbfHNRE6 (ORCPT + 99 others); Wed, 14 Aug 2019 13:04:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:53836 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728561AbfHNRE5 (ORCPT ); Wed, 14 Aug 2019 13:04:57 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 85D5D214DA; Wed, 14 Aug 2019 17:04:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802297; bh=ryyqDji8vE1T9WU4gG8iEcKm+aP8x84iFRvKo0Xh4/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oBmuKp3bJq0ga+Vq246OcQ+T95NR/yY04uOQgXf9o1bSNnxj2K6hVeLBNpIAjJPqH s9O3yeyYYwir6v55iVQgX5ddo8baptTrYI4D3r6iU0jof4OPjXnCnZYO1Kw+c57j88 rhvlHZ4nIDRWVZE57MBYGlrVRQOKkx7Kh+Jb6uas= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julian Parkin , Charlene Liu , Leo Li , Alex Deucher , Sasha Levin Subject: [PATCH 5.2 071/144] drm/amd/display: Fix dc_create failure handling and 666 color depths Date: Wed, 14 Aug 2019 19:00:27 +0200 Message-Id: <20190814165802.821915294@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 0905f32977268149f06e3ce6ea4bd6d374dd891f ] [Why] It is possible (but very unlikely) that constructing dc fails before current_state is created. We support 666 color depth in some scenarios, but this isn't handled in get_norm_pix_clk. It uses exactly the same pixel clock as the 888 case. [How] Check for non null current_state before destructing. Add case for 666 color depth to get_norm_pix_clk to avoid assertion. Signed-off-by: Julian Parkin Reviewed-by: Charlene Liu Acked-by: Leo Li Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/core/dc.c | 6 ++++-- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index ee6b646180b66..0a7adc2925e35 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -608,8 +608,10 @@ const struct dc_link_settings *dc_link_get_link_cap( static void destruct(struct dc *dc) { - dc_release_state(dc->current_state); - dc->current_state = NULL; + if (dc->current_state) { + dc_release_state(dc->current_state); + dc->current_state = NULL; + } destroy_links(dc); diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c index 6ad7b54812f1c..b2525ab8a95f6 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -1872,6 +1872,7 @@ static int get_norm_pix_clk(const struct dc_crtc_timing *timing) pix_clk /= 2; if (timing->pixel_encoding != PIXEL_ENCODING_YCBCR422) { switch (timing->display_color_depth) { + case COLOR_DEPTH_666: case COLOR_DEPTH_888: normalized_pix_clk = pix_clk; break; -- 2.20.1