Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v12 6/6] media: qcom: camss: Drop legacy PHY descriptions from x1e
Date: Wed, 08 Jul 2026 00:26:59 +0000	[thread overview]
Message-ID: <20260708002700.17CB41F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260708-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v12-6-f8588da41f16@linaro.org>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [High] Missing `phy_exit()` cleanup on probe error paths results in PHY resource leaks for non-legacy PHYs.

Pre-existing issues:
- [High] Potential out-of-bounds access in `camss_subdev_notifier_bound()` due to non-contiguous hardware IDs.
--

--- Patch [6]: [PATCH v12 6/6] media: qcom: camss: Drop legacy PHY descriptions from x1e ---
commit 77049628030f3bcd1557363f75216c90c62c80af
Author: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

media: qcom: camss: Drop legacy PHY descriptions from x1e

x1e is the first CAMSS SoC to use the new PHY interface. This patch drops
the redundant legacy CSIPHY descriptions to enable the new interface.

> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> index 146fea438486f..f360b2c99bf89 100644
> --- a/drivers/media/platform/qcom/camss/camss.c
> +++ b/drivers/media/platform/qcom/camss/camss.c
[ ... ]
> @@ -5803,7 +5767,6 @@ static const struct camss_resources sm8650_resources = {
>  static const struct camss_resources x1e80100_resources = {
>  	.version = CAMSS_X1E80100,
>  	.pd_name = "top",
> -	.legacy_phy = true,

[Severity: High]
Does dropping the legacy PHY interface introduce PHY resource leaks on probe
error paths?

If msm_csiphy_subdev_init() fails during camss_init_subdevices(), previously
initialized PHYs do not appear to be rolled back with phy_exit():

drivers/media/platform/qcom/camss/camss.c:camss_init_subdevices() {
...
			ret = msm_csiphy_subdev_init(camss, &camss->csiphy[i],
						     &res->csiphy_res[i],
						     res->csiphy_res[i].csiphy.id);
			if (ret < 0)
				return ret;
...
}

Additionally, if camss_probe() fails after camss_init_subdevices() (for
instance, in dma_set_mask_and_coherent()), the error path jumps to
err_genpd_cleanup, bypassing camss_unregister_entities() and permanently
leaking all initialized PHYs:

drivers/media/platform/qcom/camss/camss.c:camss_probe() {
...
	ret = dma_set_mask_and_coherent(dev, 0xffffffff);
	if (ret)
		goto err_genpd_cleanup;
...
}

Similarly, does camss_register_entities() fail to call phy_exit() for the
failed csiphy[i] and all subsequent PHYs, since the cleanup loop starts at
i - 1?

drivers/media/platform/qcom/camss/camss.c:camss_register_entities() {
...
err_reg_csiphy:
	for (i--; i >= 0; i--) {
		if (camss->csiphy[i].phy)
			msm_csiphy_unregister_entity(&camss->csiphy[i]);
	}
...
}


[Severity: High]
This is a pre-existing issue, but since x1e80100 defines non-contiguous PHY
IDs (0, 1, 2, and 4), does this cause an out-of-bounds access?

The csiphy_num is 4 for x1e80100, meaning the camss->csiphy array only has
4 elements. The endpoint port ID is parsed from the device tree and stored
in csd->interface.csiphy_id:

drivers/media/platform/qcom/camss/camss.c:camss_parse_endpoint_node() {
...
	csd->interface.csiphy_id = vep.base.port;
...
}

If the port number aligns with the physical hardware ID (e.g., port@4 for
CSIPHY4), will this use id = 4 to index the 4-element array in
camss_subdev_notifier_bound(), causing an out-of-bounds access?

drivers/media/platform/qcom/camss/camss.c:camss_subdev_notifier_bound() {
...
	u8 id = csd->interface.csiphy_id;
	struct csiphy_device *csiphy = &camss->csiphy[id];

	csiphy->cfg.csi2 = &csd->interface.csi2;
	subdev->host_priv = csiphy;
...
}

>  	.csiphy_res = csiphy_res_x1e80100,
>  	.tpg_res = tpg_res_x1e80100,
>  	.csid_res = csid_res_x1e80100,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260708-b4-linux-next-25-03-13-dtsi-x1e80100-camss-v12-0-f8588da41f16@linaro.org?part=6

      reply	other threads:[~2026-07-08  0:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08  0:06 [PATCH v12 0/6] Add dt-bindings and PHY updates for CAMSS on x1e80100 silicon Bryan O'Donoghue
2026-07-08  0:06 ` [PATCH v12 1/6] dt-bindings: media: qcom,x1e80100-camss: Add optional PHY handle definitions Bryan O'Donoghue
2026-07-08  0:16   ` sashiko-bot
2026-07-08  1:34   ` Rob Herring (Arm)
2026-07-08  7:49   ` Vladimir Zapolskiy
2026-07-08 22:09   ` Frank Li
2026-07-08 22:15     ` Bryan O'Donoghue
2026-07-08  0:06 ` [PATCH v12 2/6] dt-bindings: media: qcom,x1e80100-camss: Describe iommu entries Bryan O'Donoghue
2026-07-08 12:39   ` Loic Poulain
2026-07-08 15:15   ` Vikram Sharma
2026-07-08 21:32     ` Bryan O'Donoghue
2026-07-08  0:06 ` [PATCH v12 3/6] media: qcom: camss: Add support to populate sub-devices Bryan O'Donoghue
2026-07-08  0:18   ` sashiko-bot
2026-07-08  0:06 ` [PATCH v12 4/6] media: qcom: camss: Add legacy_phy flag to SoC definition structures Bryan O'Donoghue
2026-07-08  0:14   ` sashiko-bot
2026-07-08  0:16     ` Bryan O'Donoghue
2026-07-08  0:06 ` [PATCH v12 5/6] media: qcom: camss: Add support for PHY API devices Bryan O'Donoghue
2026-07-08  0:19   ` sashiko-bot
2026-07-08  0:07 ` [PATCH v12 6/6] media: qcom: camss: Drop legacy PHY descriptions from x1e Bryan O'Donoghue
2026-07-08  0:26   ` sashiko-bot [this message]

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=20260708002700.17CB41F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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