From: sashiko-bot@kernel.org
To: "David Heidelberg via B4 Relay" <devnull+david.ixit.cz@kernel.org>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH v6 2/8] media: qcom: camss: csiphy-3ph: Use odd bits for configuring C-PHY lanes
Date: Tue, 02 Jun 2026 23:55:52 +0000 [thread overview]
Message-ID: <20260602235552.D754D1F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260603-qcom-cphy-v6-2-e50de0b557a8@ixit.cz>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch claims to allow returning a failure for unrecognized bus configurations, but silently ignores the error and proceeds with hardware configuration.
--
commit 0f031c8a889a78fead270238000243029f1f3462
Author: David Heidelberg <david@ixit.cz>
media: qcom: camss: csiphy-3ph: Use odd bits for configuring C-PHY lanes
This commit adds C-PHY support by using odd bits for configuration instead
of even bits. It also mentions allowing failures for unrecognized
configurations.
> Since there can be unrecognized configuration allow returning failure.
[Severity: Medium]
The commit message mentions allowing returning failure for unrecognized
configurations, but does the implementation actually propagate any errors
back to the caller?
> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
> index dac8d2ecf7995..15876eb973718 100644
> --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
> +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
[ ... ]
> @@ -1113,13 +1114,22 @@ static void csiphy_gen2_config_lanes(struct csiphy_device *csiphy,
>
> static u8 csiphy_get_lane_mask(struct csiphy_lanes_cfg *lane_cfg)
> {
> - u8 lane_mask;
> - int i;
> + u8 lane_mask = 0;
>
> - lane_mask = CSIPHY_3PH_CMN_CSI_COMMON_CTRL5_CLK_ENABLE;
> + switch (lane_cfg->phy_cfg) {
> + case V4L2_MBUS_CSI2_CPHY:
> + for (int i = 0; i < lane_cfg->num_data; i++)
> + lane_mask |= BIT(lane_cfg->data[i].pos + 1);
> + break;
> + case V4L2_MBUS_CSI2_DPHY:
> + lane_mask = CSIPHY_3PH_CMN_CSI_COMMON_CTRL5_CLK_ENABLE;
>
> - for (i = 0; i < lane_cfg->num_data; i++)
> - lane_mask |= 1 << lane_cfg->data[i].pos;
> + for (int i = 0; i < lane_cfg->num_data; i++)
> + lane_mask |= BIT(lane_cfg->data[i].pos);
> + break;
> + default:
> + break;
> + }
>
> return lane_mask;
> }
[Severity: Medium]
If the configuration is unrecognized, csiphy_get_lane_mask() returns 0.
Since the caller treats 0 as a valid u8 mask, how does it detect the
unrecognized configuration failure mentioned in the commit message?
[ ... ]
> @@ -1160,9 +1170,22 @@ static void csiphy_lanes_enable(struct csiphy_device *csiphy,
>
> settle_cnt = csiphy_settle_cnt_calc(link_freq, csiphy->timer_clk_rate);
>
> - val = CSIPHY_3PH_CMN_CSI_COMMON_CTRL5_CLK_ENABLE;
> - for (i = 0; i < c->num_data; i++)
> - val |= BIT(c->data[i].pos * 2);
> + val = 0;
> +
> + switch (c->phy_cfg) {
> + case V4L2_MBUS_CSI2_CPHY:
> + for (i = 0; i < c->num_data; i++)
> + val |= BIT((c->data[i].pos * 2) + 1);
> + break;
> + case V4L2_MBUS_CSI2_DPHY:
> + val = CSIPHY_3PH_CMN_CSI_COMMON_CTRL5_CLK_ENABLE;
> +
> + for (i = 0; i < c->num_data; i++)
> + val |= BIT(c->data[i].pos * 2);
> + break;
> + default:
> + WARN_ONCE(1, "Unsupported bus type %d!\n", c->phy_cfg);
> + }
>
> writel_relaxed(val, csiphy->base +
> CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->offset, 5));
[Severity: Medium]
Here csiphy_lanes_enable() prints a warning but proceeds to configure the
hardware registers with val = 0.
Since the return type of csiphy_lanes_enable() is void, the caller
csiphy_stream_on() can't check for failure, and ultimately returns 0
(success) to V4L2:
drivers/media/platform/qcom/camss/camss-csiphy.c:csiphy_stream_on() {
...
csiphy->res->hw_ops->lanes_enable(csiphy, cfg, link_freq, lane_mask);
return 0;
}
Should csiphy_lanes_enable() be updated to return an int so we can abort
and return an error like -EINVAL?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260603-qcom-cphy-v6-0-e50de0b557a8@ixit.cz?part=2
next prev parent reply other threads:[~2026-06-02 23:55 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 23:30 [PATCH v6 0/8] media: camss: Add support for C-PHY configuration on Qualcomm platforms David Heidelberg via B4 Relay
2026-06-02 23:30 ` David Heidelberg
2026-06-02 23:30 ` [PATCH v6 1/8] media: qcom: camss: csiphy: Introduce PHY configuration David Heidelberg via B4 Relay
2026-06-02 23:30 ` David Heidelberg
2026-06-03 21:34 ` Frank Li
2026-06-02 23:30 ` [PATCH v6 2/8] media: qcom: camss: csiphy-3ph: Use odd bits for configuring C-PHY lanes David Heidelberg via B4 Relay
2026-06-02 23:30 ` David Heidelberg
2026-06-02 23:55 ` sashiko-bot [this message]
2026-06-03 21:42 ` Frank Li
2026-06-03 21:57 ` Bryan O'Donoghue
2026-06-04 12:08 ` David Heidelberg
2026-06-02 23:30 ` [PATCH v6 3/8] media: qcom: camss: Prepare CSID for C-PHY support David Heidelberg via B4 Relay
2026-06-02 23:30 ` David Heidelberg
2026-06-03 0:03 ` sashiko-bot
2026-06-03 21:47 ` Frank Li
2026-06-04 12:34 ` David Heidelberg
2026-06-04 19:07 ` Frank Li
2026-06-05 8:50 ` Bryan O'Donoghue
2026-06-02 23:30 ` [PATCH v6 4/8] media: qcom: camss: Initialize lanes after lane configuration is available David Heidelberg via B4 Relay
2026-06-02 23:30 ` David Heidelberg
2026-06-03 0:13 ` sashiko-bot
2026-06-03 21:49 ` Frank Li
2026-06-02 23:30 ` [PATCH v6 5/8] media: qcom: camss: csiphy-3ph: Add Gen2 v1.1 MIPI CSI-2 C-PHY init David Heidelberg via B4 Relay
2026-06-02 23:30 ` David Heidelberg
2026-06-03 0:26 ` sashiko-bot
2026-06-03 21:53 ` Frank Li
2026-06-05 10:25 ` Bryan O'Donoghue
2026-06-05 14:47 ` Michael Srba
2026-06-05 22:20 ` Bryan O'Donoghue
2026-06-02 23:30 ` [PATCH v6 6/8] media: qcom: camss: csiphy-3ph: Update " David Heidelberg via B4 Relay
2026-06-02 23:30 ` David Heidelberg
2026-06-02 23:30 ` [PATCH v6 7/8] media: qcom: camss: Account for C-PHY when calculating link frequency David Heidelberg via B4 Relay
2026-06-02 23:30 ` David Heidelberg
2026-06-03 0:53 ` sashiko-bot
2026-06-02 23:30 ` [PATCH v6 8/8] media: qcom: camss: Enable C-PHY where available David Heidelberg via B4 Relay
2026-06-02 23:30 ` David Heidelberg
2026-06-03 21:54 ` Frank Li
2026-06-03 10:03 ` [PATCH v6 0/8] media: camss: Add support for C-PHY configuration on Qualcomm platforms Bryan O'Donoghue
2026-06-03 10:17 ` David Heidelberg
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=20260602235552.D754D1F00898@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=devnull+david.ixit.cz@kernel.org \
--cc=linux-media@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.