All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mikita Lipski <mikita.lipski@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Harry.Wentland@amd.com>, <Sunpeng.Li@amd.com>,
	<Bhawanpreet.Lakha@amd.com>, <Rodrigo.Siqueira@amd.com>,
	<Aurabindo.Pillai@amd.com>, <Qingqing.Zhuo@amd.com>,
	<mikita.lipski@amd.com>,  <Anson.Jacob@amd.com>,
	Meenakshikumar Somasundaram <meenakshikumar.somasundaram@amd.com>,
	Jimmy Kizito <jimmy.kizito@amd.com>
Subject: [PATCH 13/19] drm/amd/display: Fix for null pointer access for ddc pin and aux engine.
Date: Fri, 27 Aug 2021 16:29:04 -0400	[thread overview]
Message-ID: <20210827202910.20864-14-mikita.lipski@amd.com> (raw)
In-Reply-To: <20210827202910.20864-1-mikita.lipski@amd.com>

From: Meenakshikumar Somasundaram <meenakshikumar.somasundaram@amd.com>

[Why]
Need a check for NULL pointer access for ddc pin and aux engine.

[How]
Adding a check for ddc pin and aux engine accesses.

Reviewed-by: Jimmy Kizito <jimmy.kizito@amd.com>
Acked-by: Mikita Lipski <mikita.lipski@amd.com>
Signed-off-by: Meenakshikumar Somasundaram <meenakshikumar.somasundaram@amd.com>
---
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.c      | 12 +++++++++---
 drivers/gpu/drm/amd/display/include/dal_asic_id.h |  2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
index 2fb88e54a4bf..a75487ed1bb6 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
@@ -630,8 +630,8 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc,
 	enum aux_return_code_type operation_result;
 	bool retry_on_defer = false;
 	struct ddc *ddc_pin = ddc->ddc_pin;
-	struct dce_aux *aux_engine = ddc->ctx->dc->res_pool->engines[ddc_pin->pin_data->en];
-	struct aux_engine_dce110 *aux110 = FROM_AUX_ENGINE(aux_engine);
+	struct dce_aux *aux_engine = NULL;
+	struct aux_engine_dce110 *aux110 = NULL;
 	uint32_t defer_time_in_ms = 0;
 
 	int aux_ack_retries = 0,
@@ -640,6 +640,11 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc,
 		aux_timeout_retries = 0,
 		aux_invalid_reply_retries = 0;
 
+	if (ddc_pin) {
+		aux_engine = ddc->ctx->dc->res_pool->engines[ddc_pin->pin_data->en];
+		aux110 = FROM_AUX_ENGINE(aux_engine);
+	}
+
 	if (!payload->reply) {
 		payload_reply = false;
 		payload->reply = &reply;
@@ -666,7 +671,8 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc,
 
 			case AUX_TRANSACTION_REPLY_AUX_DEFER:
 				/* polling_timeout_period is in us */
-				defer_time_in_ms += aux110->polling_timeout_period / 1000;
+				if (aux110)
+					defer_time_in_ms += aux110->polling_timeout_period / 1000;
 				++aux_defer_retries;
 				fallthrough;
 			case AUX_TRANSACTION_REPLY_I2C_OVER_AUX_DEFER:
diff --git a/drivers/gpu/drm/amd/display/include/dal_asic_id.h b/drivers/gpu/drm/amd/display/include/dal_asic_id.h
index 381c17caace1..3d2f0817e40a 100644
--- a/drivers/gpu/drm/amd/display/include/dal_asic_id.h
+++ b/drivers/gpu/drm/amd/display/include/dal_asic_id.h
@@ -227,7 +227,7 @@ enum {
 #define FAMILY_YELLOW_CARP                     146
 
 #define YELLOW_CARP_A0 0x01
-#define YELLOW_CARP_B0 0x02		// TODO: DCN31 - update with correct B0 ID
+#define YELLOW_CARP_B0 0x20
 #define YELLOW_CARP_UNKNOWN 0xFF
 
 #ifndef ASICREV_IS_YELLOW_CARP
-- 
2.25.1


  parent reply	other threads:[~2021-08-27 20:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-27 20:28 [PATCH 00/19] DC Patches August 23, 2021 Mikita Lipski
2021-08-27 20:28 ` [PATCH 01/19] drm/amd/display: cleanup idents after a revert Mikita Lipski
2021-08-27 20:28 ` [PATCH 02/19] drm/amd/display: Initialize lt_settings on instantiation Mikita Lipski
2021-08-27 20:28 ` [PATCH 03/19] drm/amd/display: Add DPCD writes at key points Mikita Lipski
2021-08-27 20:28 ` [PATCH 04/19] drm/amd/display: Fix system hang at boot Mikita Lipski
2021-08-27 20:28 ` [PATCH 05/19] drm/amd/display: Drop unused privacy_mask setters and getters Mikita Lipski
2021-08-27 20:28 ` [PATCH 06/19] drm/amd/display: expose dsc overhead bw in dc dsc header Mikita Lipski
2021-08-27 20:28 ` [PATCH 07/19] drm/amd/display: move bpp range decision in decide dsc bw range function Mikita Lipski
2021-08-27 20:28 ` [PATCH 08/19] drm/amd/display: Add option to defer works of hpd_rx_irq Mikita Lipski
2021-08-27 20:29 ` [PATCH 09/19] drm/amd/display: Fork thread to offload work " Mikita Lipski
2021-08-27 20:29 ` [PATCH 10/19] drm/amd/display: unblock abm when odm is enabled only on configs that support it Mikita Lipski
2021-08-27 20:29 ` [PATCH 11/19] drm/amd/display: Add flag to detect dpms force off during HPD Mikita Lipski
2021-08-27 20:29 ` [PATCH 12/19] drm/amd/display: Fix false BAD_FREE warning from Coverity Mikita Lipski
2021-08-27 20:29 ` Mikita Lipski [this message]
2021-08-27 20:29 ` [PATCH 14/19] drm/amd/display: [FW Promotion] Release 0.0.81 Mikita Lipski
2021-08-27 20:29 ` [PATCH 15/19] drm/amd/display: 3.2.151 Mikita Lipski
2021-08-27 20:29 ` [PATCH 16/19] drm/amd/display: Fix multiple memory leaks reported by coverity Mikita Lipski
2021-08-27 20:29 ` [PATCH 17/19] drm/amd/display: Get backlight from PWM if DMCU is not initialized Mikita Lipski
2021-08-27 20:29   ` Mikita Lipski
2021-08-27 20:29 ` [PATCH 18/19] drm/amd/display: Revert "Directly retrain link from debugfs" Mikita Lipski
2021-08-27 20:29 ` [PATCH 19/19] drm/amd/display: Add regamma/degamma coefficients and set sRGB when TF is BT709 Mikita Lipski
2021-08-30 14:12 ` [PATCH 00/19] DC Patches August 23, 2021 Wheeler, Daniel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210827202910.20864-14-mikita.lipski@amd.com \
    --to=mikita.lipski@amd.com \
    --cc=Anson.Jacob@amd.com \
    --cc=Aurabindo.Pillai@amd.com \
    --cc=Bhawanpreet.Lakha@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Qingqing.Zhuo@amd.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=Sunpeng.Li@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=jimmy.kizito@amd.com \
    --cc=meenakshikumar.somasundaram@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.