From nobody Sun Oct 5 03:38:54 2025 Received: from lelvem-ot02.ext.ti.com (lelvem-ot02.ext.ti.com [198.47.23.235]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AF5A2DA74C for ; Mon, 11 Aug 2025 08:00:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.235 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754899207; cv=none; b=d0Qg3iH1wd8violVL2zXAeCWzbD1HVJnw1E0O6z0M6RSQOREYUWzhZcaBxNsR1CLnN1RLNiHoBQSJpdfW3lh4m8USlO/yx6I5jAA5ripnLMquw+pII4FUbKajmLcwehVAMCLK6I19Awcs1Ks6VoFluHTcoXNlQAuPmevgqyGtBw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754899207; c=relaxed/simple; bh=MH9ZpShy3JftpqZtikiUKgJPj/Wxyax6AC/PAij79dc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Pp6MxlMcBib2yHhsp5xWVEoI5r3lBhX6klLqUtXQcgr8jSfz8Cc30GEKKimCBwVZALcoIayoqXRyHxYrjwOznoGXgp1mzw9ngFPWaGdY+epNKrO476PUprIFlJ4liWy96EYBYGgHQ4yUfkB7IgurjKlFid4L7dGJcBaoeLtF9gs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=WKzwYhLk; arc=none smtp.client-ip=198.47.23.235 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="WKzwYhLk" Received: from fllvem-sh04.itg.ti.com ([10.64.41.54]) by lelvem-ot02.ext.ti.com (8.15.2/8.15.2) with ESMTP id 57B7xZNQ1563978; Mon, 11 Aug 2025 02:59:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1754899175; bh=ogQ0/a2jplUPEj2tZMhi2fBRhuo9FehYw8a3RvdQehc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=WKzwYhLkg2Ae3VwhKUgokDB9rQfJgVtZ6N0zkeuaawyaWspwWl5wLFmSq/+fu7MO7 6AWLjNZPB/PWextPpg4dwGiZ7RgCLYLdn1x7KDPoRp77UoOh9Lrq384jB+jbic/hFO 9Ny4/lZItSzBVx2WNFIoBfEvgBFCxDDznaRE4Cqw= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by fllvem-sh04.itg.ti.com (8.18.1/8.18.1) with ESMTPS id 57B7xYA73560530 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=FAIL); Mon, 11 Aug 2025 02:59:35 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.55; Mon, 11 Aug 2025 02:59:34 -0500 Received: from lelvem-mr05.itg.ti.com (10.180.75.9) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.55 via Frontend Transport; Mon, 11 Aug 2025 02:59:34 -0500 Received: from hkshenoy.dhcp.ti.com (hkshenoy.dhcp.ti.com [172.24.235.208]) by lelvem-mr05.itg.ti.com (8.18.1/8.18.1) with ESMTP id 57B7x5Cv2817433; Mon, 11 Aug 2025 02:59:27 -0500 From: Harikrishna Shenoy To: , , , , , , , , CC: , , , , , , , , , , , , , , , , , Subject: [PATCH v5 3/6] drm/bridge: cadence: cdns-mhdp8546-core: Set the mhdp connector earlier in atomic_enable() Date: Mon, 11 Aug 2025 13:29:01 +0530 Message-ID: <20250811075904.1613519-4-h-shenoy@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250811075904.1613519-1-h-shenoy@ti.com> References: <20250811075904.1613519-1-h-shenoy@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea Content-Type: text/plain; charset="utf-8" From: Jayesh Choudhary In case if we get errors in cdns_mhdp_link_up() or cdns_mhdp_reg_read() in atomic_enable, we will go to cdns_mhdp_modeset_retry_fn() and will hit NULL pointer while trying to access the mutex. We need the connector to be set before that. Unlike in legacy !(DBANC) cases, we do not have connector initialised in bridge_attach(). So set the mhdp->connector in atomic_enable() earlier to avoid possible NULL pointer. Fixes: c932ced6b585 ("drm/tidss: Update encoder/bridge chain connect model") Signed-off-by: Jayesh Choudhary --- .../drm/bridge/cadence/cdns-mhdp8546-core.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/= gpu/drm/bridge/cadence/cdns-mhdp8546-core.c index c2ce3d6e5a88..b2f5a48cac2d 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c @@ -1759,12 +1759,21 @@ static void cdns_mhdp_atomic_enable(struct drm_brid= ge *bridge, struct drm_bridge_state *new_state; const struct drm_display_mode *mode; u32 resp; - int ret; + int ret =3D 0; =20 dev_dbg(mhdp->dev, "bridge enable\n"); =20 mutex_lock(&mhdp->link_mutex); =20 + mhdp->connector =3D drm_atomic_get_new_connector_for_encoder(state, + bridge->encoder); + if (WARN_ON(!mhdp->connector)) + goto out; + + conn_state =3D drm_atomic_get_new_connector_state(state, mhdp->connector); + if (WARN_ON(!conn_state)) + goto out; + if (mhdp->plugged && !mhdp->link_up) { ret =3D cdns_mhdp_link_up(mhdp); if (ret < 0) @@ -1784,15 +1793,6 @@ static void cdns_mhdp_atomic_enable(struct drm_bridg= e *bridge, cdns_mhdp_reg_write(mhdp, CDNS_DPTX_CAR, resp | CDNS_VIF_CLK_EN | CDNS_VIF_CLK_RSTN); =20 - mhdp->connector =3D drm_atomic_get_new_connector_for_encoder(state, - bridge->encoder); - if (WARN_ON(!mhdp->connector)) - goto out; - - conn_state =3D drm_atomic_get_new_connector_state(state, mhdp->connector); - if (WARN_ON(!conn_state)) - goto out; - if (mhdp->hdcp_supported && mhdp->hw_state =3D=3D MHDP_HW_READY && conn_state->content_protection =3D=3D --=20 2.34.1