Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1069292ybl; Wed, 14 Aug 2019 10:12:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3lOWlMVQtfC/gVv3DDbM96yY+UpxxS2A54TO4iOP40uJ2gQUKqS54uomM6FhVuhCM/LNQ X-Received: by 2002:a17:90a:eb08:: with SMTP id j8mr786257pjz.72.1565802727861; Wed, 14 Aug 2019 10:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802727; cv=none; d=google.com; s=arc-20160816; b=UFacDRUENWZ9jAl6Dfk9uDoWovkwaFKvzbXy8zEGu8mOKmSZMG6NnwijFTDp9fJJo6 dj1C+T/Tm72rQq7LUe6X0S9+55Kp5bzINa6YhOZNgur40pg0LGz3mqOFK8mRr1MIkI41 3E0/SPMbkHmQARYhML9P0SUr1Afc3rMxoCkD24/jPHGreQLHctxBj5dMXBWmLLLSpk5g qrXEnWepfP9glqI6fhFItb/CGHPOSUruMF2BT5jBFdvUnh0A/Zv64fs48IyL/bUOD9Lk 99OnPa08wZyztJ3KzVbHOwhQ4L7pV2lkfYP/XJyYvwJ5LQ2yyW4riIAa3IZbjQ6iuZ13 A8jg== 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=ssmz0PbbiWXDpTJOeOkg9ns6rBlArS9IhcdAbBPdiB4=; b=bXKfmX3kllM1kuzpuPKmN2B08AzixMWJMpnawyg80ipLIwyF6aCLDbUzRo/NyIORET HzWJLlq6zE64WXJTQt30/2iN8mXBujHTzG8VJbGWCol18pozP3R+wRLJR0GJ9H3iATBC kHNh6/0ueHDYYKq+21u/hIOJczFejPEJSn5iytUykpljXBSkOxGrBnOEWhsU5AfGF6ZZ Vg0GsCoME0o7VMAsVyRTf8DOKlvcuKOiqU9Kq4MwzFyFFg+Y7/mul87QGxRdr1EYSxt7 YoNFuQJ4EaC6JFfxQJ/MzLzgrVSdW077CxEGylJI9rz46VhouWckYDj9CBDEvFXuTpD8 SUuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yYhm26Xm; 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 m27si72125pff.186.2019.08.14.10.11.52; Wed, 14 Aug 2019 10:12:07 -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=yYhm26Xm; 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 S1730204AbfHNRLB (ORCPT + 99 others); Wed, 14 Aug 2019 13:11:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:34006 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730543AbfHNRK5 (ORCPT ); Wed, 14 Aug 2019 13:10: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 5E3D1208C2; Wed, 14 Aug 2019 17:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802656; bh=yNpnDY9dA4qEpZ84ZOy+bWy9iA+sKcTEtfc0IAr6/o8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yYhm26Xml+YELh61Pn7ujPIA1CI89iGoEi83KvbT7p2GrWLLWecnutFF0WB666FrD 4yKDTkKNAtQiXrabE6rdQ7s0O5ccCfKg1hUFS5becIV5iTFVBZwg8ncPuMT6WpW95L OUuLXYwDtN33IlP0zccQilqnqVROGTL7ElYefHP0= 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 4.19 41/91] drm/amd/display: Fix dc_create failure handling and 666 color depths Date: Wed, 14 Aug 2019 19:01:04 +0200 Message-Id: <20190814165751.377408708@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165748.991235624@linuxfoundation.org> References: <20190814165748.991235624@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 e3f5e5d6f0c18..f4b89d1ea6f6f 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -462,8 +462,10 @@ void dc_link_set_test_pattern(struct dc_link *link, 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 06d5988dff723..19a951e5818ac 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