From nobody Fri Oct 3 01:10:46 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 361C227AC44 for ; Tue, 9 Sep 2025 09:09:22 +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=1757408964; cv=none; b=LxujDc7T+rOoVMG4racSzDMVuVtqxNqNPKeOorTvfeoWSfDPdKgVhgKmnrComnwiNVSvyUsWjLUk1bQfvG5W0ogQxqYcGdhqPhUb8IdvssIx78I9a94Q1Quaae8neRElHZSeCOIqoz8dsSfAzjUuM9c4V4Ex+TxOc9v0R8UVJCo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757408964; c=relaxed/simple; bh=MH9ZpShy3JftpqZtikiUKgJPj/Wxyax6AC/PAij79dc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=H5nY1EpMN6ZoY5CEYa3TR2aAuMpzlaJTDAFXJI9VXycdMN9N1P1Hae2qIwmU/7hYwuEO991Hmw0i7DzDRmT1PQyV4sIj30K3exB4m4FkvBmAD+3lT8d4EOYEsXidpawQbyXzTpPKgkyKx5MXR07QaC+1xh4SxMS6Ur0GY4ERYho= 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=BAjuGkSm; 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="BAjuGkSm" Received: from lelvem-sh01.itg.ti.com ([10.180.77.71]) by lelvem-ot02.ext.ti.com (8.15.2/8.15.2) with ESMTP id 58998vO4305731; Tue, 9 Sep 2025 04:08:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1757408937; bh=ogQ0/a2jplUPEj2tZMhi2fBRhuo9FehYw8a3RvdQehc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=BAjuGkSmKNhywD/dYjQA1uWQ9OllT3U7p1bIwKwMS1cvFcd2kRx/H7juF/i35guNy OPSXOK8ZmWDBXbQHr85+X5E9D3Fcgzvz/l9IvmzEETNRhsTc4YiIn7N+jwopUJ8tqA A0I/OVvxCOHW25gngrj/XF+5Z9Sfb8qvPePoXSQg= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by lelvem-sh01.itg.ti.com (8.18.1/8.18.1) with ESMTPS id 58998vVU3048984 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=FAIL); Tue, 9 Sep 2025 04:08:57 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.55; Tue, 9 Sep 2025 04:08:56 -0500 Received: from lelvem-mr05.itg.ti.com (10.180.75.9) by DFLE102.ent.ti.com (10.64.6.23) 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; Tue, 9 Sep 2025 04:08:56 -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 58998Pkt2399851; Tue, 9 Sep 2025 04:08:49 -0500 From: Harikrishna Shenoy To: , , , , , , , , , , , , , , , , , , , , , , , , CC: , Subject: [PATCH v6 3/6] drm/bridge: cadence: cdns-mhdp8546-core: Set the mhdp connector earlier in atomic_enable() Date: Tue, 9 Sep 2025 14:38:21 +0530 Message-ID: <20250909090824.1655537-4-h-shenoy@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250909090824.1655537-1-h-shenoy@ti.com> References: <20250909090824.1655537-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