Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jason Yang" <jason98166@gmail.com>
Cc: conor+dt@kernel.org, neil.armstrong@linaro.org,
	olteanv@gmail.com, vkoul@kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, linux-phy@lists.infradead.org
Subject: Re: [PATCH 3/4] phy: rockchip-samsung-dcphy: model TX and RX as separate PHYs
Date: Tue, 21 Jul 2026 10:44:55 +0000	[thread overview]
Message-ID: <20260721104456.0695D1F01560@smtp.kernel.org> (raw)
In-Reply-To: <20260721-dcphy-rx-v1-v1-3-4fc83c0ccac9@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Concurrent or unsupported PHY configuration clobbers the shared `samsung->lanes` driver state before verifying the direction is supported.
--

--- Patch [3]: [PATCH 3/4] phy: rockchip-samsung-dcphy: model TX and RX as separate PHYs ---
commit 242b9435d09e0133de4658156f3cc224aa2f84c9
Author: Jason Yang <jason98166@gmail.com>

phy: rockchip-samsung-dcphy: model TX and RX as separate PHYs

This commit models the MIPI DSI transmitter and MIPI CSI receiver as separate
PHYs that share the same hardware block. It registers one struct phy per
direction and adds a per-provider mutex to serialize access to the shared
state.

> diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c b/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c
> --- a/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c
> +++ b/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c

[ ... ]

> @@ -1488,11 +1521,15 @@ samsung_mipi_dcphy_pll_calc_rate(struct samsung_mipi_dcphy *samsung,
>  static int samsung_mipi_dcphy_configure(struct phy *phy,
>  					union phy_configure_opts *opts)
>  {
> -	struct samsung_mipi_dcphy *samsung = phy_get_drvdata(phy);
> +	struct samsung_mipi_dcphy_dir *pd = phy_get_drvdata(phy);
> +	struct samsung_mipi_dcphy *samsung = pd->parent;
>  	unsigned long long target_rate = opts->mipi_dphy.hs_clk_rate;
>  
>  	samsung->lanes = opts->mipi_dphy.lanes > 4 ? 4 : opts->mipi_dphy.lanes;
>  
> +	if (pd->dir == RK_DCPHY_DIR_RX)
> +		return -EOPNOTSUPP;
> +

[Severity: High]
Does this code modify the shared samsung->lanes state before checking if
the direction is supported?

Since this is done without holding samsung->lock, can a consumer
configuring the RX PHY clobber the active TX PHY's lane count?

If the lane count is corrupted, it looks like it could lead to incorrect lane
power-down sequences when the TX PHY is disabled later, potentially leaving
MIPI lanes actively driven.

Should the pd->dir check and the lock acquisition happen before updating
samsung->lanes?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260721-dcphy-rx-v1-v1-0-4fc83c0ccac9@gmail.com?part=3

  reply	other threads:[~2026-07-21 10:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 10:35 [PATCH 0/4] phy: rockchip-samsung-dcphy: support the D-PHY receiver direction Jason Yang via B4 Relay
2026-07-21 10:35 ` [PATCH 1/4] dt-bindings: phy: rockchip,rk3588-mipi-dcphy: support per-direction phys Jason Yang via B4 Relay
2026-07-21 10:44   ` sashiko-bot
2026-07-21 10:35 ` [PATCH 2/4] phy: rockchip-samsung-dcphy: factor MIPI D-PHY power on/off into helpers Jason Yang via B4 Relay
2026-07-21 10:35 ` [PATCH 3/4] phy: rockchip-samsung-dcphy: model TX and RX as separate PHYs Jason Yang via B4 Relay
2026-07-21 10:44   ` sashiko-bot [this message]
2026-07-21 10:35 ` [PATCH 4/4] phy: rockchip-samsung-dcphy: add MIPI D-PHY receiver support Jason Yang via B4 Relay
2026-07-21 10:57   ` sashiko-bot

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=20260721104456.0695D1F01560@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jason98166@gmail.com \
    --cc=linux-phy@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox