From nobody Thu Oct 9 00:04:27 2025 Received: from fllvem-ot04.ext.ti.com (fllvem-ot04.ext.ti.com [198.47.19.246]) (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 86EF923B607 for ; Tue, 24 Jun 2025 05:45:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.246 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750743936; cv=none; b=GbGT6xkRUbxfVZ8beVhaCVEk0NNvvCHheCR63Wkp2INE53WAgnUDEOKf3Q8pJ0CTy0fiunSRPrsWaXnDparhipS7U41CHzACAQCxLTSnEJGH1VN6FrrqYyElx2qwCRLkfe+E5itpeey0oA/1gYV28cI3rnZIiJJ0Tn7XdGCvzMA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750743936; c=relaxed/simple; bh=KkEE5zzFXl+bj9sQgLw3zRqPC7DgjMSFsy/W2cP1s74=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ufWwKhoqKuJ9Zf2Hy6SKp3AABOqQJkDHj9BoTgCSyWadw3zJcYY1PDHFIDklJvD/7zEUnLNM43jtuoxO8fcJ66MXMQgEpU70lvFInT9r7uANYlwsuS5kHOH3Eg5BzUSkKV1SxYySTtSfuLRyo+Fb+ON0yGQ7FH7Q7QcX0uKtHg0= 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=IgChX0kx; arc=none smtp.client-ip=198.47.19.246 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="IgChX0kx" Received: from lelvem-sh02.itg.ti.com ([10.180.78.226]) by fllvem-ot04.ext.ti.com (8.15.2/8.15.2) with ESMTP id 55O5it6I1774779; Tue, 24 Jun 2025 00:44:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1750743895; bh=eTKTSCgwQi63eDxsR5VB/2nK8gnFY+9cx8VUiRRuPb8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=IgChX0kx6ABJVXlhfGLRMJvQRbZs5KEFb5WGVYyKD16kbzyG1EgcC1fga/lypYWnE JLVbsDp+42/55NcWzIyvb3lBq8qmTEV2SI7ah+xCvgNzos3oCZe4XaVlv6tbwS7jv/ 2yM9Q3OCVX7gnR44Kk2A2doJCqqRMv0Jp4iUpXZc= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by lelvem-sh02.itg.ti.com (8.18.1/8.18.1) with ESMTPS id 55O5itwI1441877 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=FAIL); Tue, 24 Jun 2025 00:44:55 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.55; Tue, 24 Jun 2025 00:44:54 -0500 Received: from lelvem-mr05.itg.ti.com (10.180.75.9) by DLEE100.ent.ti.com (157.170.170.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; Tue, 24 Jun 2025 00:44:54 -0500 Received: from localhost (jayesh-hp-z2-tower-g5-workstation.dhcp.ti.com [172.24.227.214]) by lelvem-mr05.itg.ti.com (8.18.1/8.18.1) with ESMTP id 55O5is1W1225658; Tue, 24 Jun 2025 00:44:54 -0500 From: Jayesh Choudhary To: , , , , , , , , CC: , , , , , , , , , , , , , , Subject: [PATCH v4 3/5] drm/bridge: cadence: cdns-mhdp8546-core: Set the mhdp connector earlier in atomic_enable() Date: Tue, 24 Jun 2025 11:14:46 +0530 Message-ID: <20250624054448.192801-4-j-choudhary@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250624054448.192801-1-j-choudhary@ti.com> References: <20250624054448.192801-1-j-choudhary@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" 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 1136daaa6c90..872a2c4e1701 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