From: Peter Marshall <pm@petermarshall.ca>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Benjamin Mugnier <benjamin.mugnier@foss.st.com>,
Sylvain Petinot <sylvain.petinot@foss.st.com>
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-media@vger.kernel.org, platform-driver-x86@vger.kernel.org,
Peter Marshall <pm@petermarshall.ca>
Subject: [PATCH 06/11] media: i2c: st,vd55g1: Handle virtual firmware graph endpoints
Date: Fri, 18 Sep 2026 18:17:00 -0400 [thread overview]
Message-ID: <20260918221705.323510-7-pm@petermarshall.ca> (raw)
In-Reply-To: <20260918221705.323510-1-pm@petermarshall.ca>
The firmware graph endpoint may be conveyed by a software node from
a module that has not been loaded yet, causing the module to bail out.
v4l2_fwnode_endpoint_alloc_parse() handles a NULL/missing endpoint by
returning -EPROBE_DEFER. Skip our own validation in the device tree
parsing logic and rely on its native error handling.
Clean up the fwnode allocation by handling it inside check_csi_conf().
Signed-off-by: Peter Marshall <pm@petermarshall.ca>
---
drivers/media/i2c/vd55g1.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/drivers/media/i2c/vd55g1.c b/drivers/media/i2c/vd55g1.c
index 032b76a84638..3e2261a95f2d 100644
--- a/drivers/media/i2c/vd55g1.c
+++ b/drivers/media/i2c/vd55g1.c
@@ -1792,16 +1792,19 @@ static int vd55g1_power_off(struct device *dev)
return 0;
}
-static int vd55g1_check_csi_conf(struct vd55g1 *sensor,
- struct fwnode_handle *endpoint)
+static int vd55g1_check_csi_conf(struct vd55g1 *sensor)
{
struct v4l2_fwnode_endpoint ep = { .bus_type = V4L2_MBUS_CSI2_DPHY };
+ struct fwnode_handle *fwnode;
u8 n_lanes;
int ret;
- ret = v4l2_fwnode_endpoint_alloc_parse(endpoint, &ep);
+ fwnode = fwnode_graph_get_endpoint_by_id(dev_fwnode(sensor->dev),
+ 0, 0, 0);
+
+ ret = v4l2_fwnode_endpoint_alloc_parse(fwnode, &ep);
if (ret)
- return -EINVAL;
+ goto fwnode;
/* Check lanes number */
n_lanes = ep.bus.mipi_csi2.num_data_lanes;
@@ -1839,6 +1842,9 @@ static int vd55g1_check_csi_conf(struct vd55g1 *sensor,
done:
v4l2_fwnode_endpoint_free(&ep);
+fwnode:
+ fwnode_handle_put(fwnode);
+
return ret;
}
@@ -1905,18 +1911,9 @@ static int vd55g1_parse_dt_gpios(struct vd55g1 *sensor)
static int vd55g1_parse_dt(struct vd55g1 *sensor)
{
- struct fwnode_handle *endpoint;
int ret;
- endpoint = fwnode_graph_get_endpoint_by_id(dev_fwnode(sensor->dev),
- 0, 0, 0);
- if (!endpoint) {
- dev_err(sensor->dev, "Endpoint node not found\n");
- return -EINVAL;
- }
-
- ret = vd55g1_check_csi_conf(sensor, endpoint);
- fwnode_handle_put(endpoint);
+ ret = vd55g1_check_csi_conf(sensor);
if (ret)
return ret;
--
2.55.0
next prev parent reply other threads:[~2026-09-18 22:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 22:16 [PATCH v2 00/11] media: i2c: st-vd55g1: Genericize driver and add VD55G0 support Peter Marshall
2026-09-18 22:16 ` [PATCH 01/11] dt-bindings: media: i2c: st,vd55g1: Move allOf: after required: Peter Marshall
2026-09-19 7:04 ` Krzysztof Kozlowski
2026-09-18 22:16 ` [PATCH 02/11] media: dt-bindings: i2c: vd55g1: Add vd55g0 compatible Peter Marshall
2026-09-19 7:06 ` Krzysztof Kozlowski
2026-09-18 22:16 ` [PATCH 03/11] media: ipu-bridge: Add VD55G0 to the list of supported sensors Peter Marshall
2026-09-18 22:16 ` [PATCH 04/11] platform/x86: int3472: Add VD55G0 supply GPIO mapping Peter Marshall
2026-09-18 22:16 ` [PATCH 05/11] media: i2c: st-vd55g1: Default to illuminator on GPIO 1 Peter Marshall
2026-09-18 22:17 ` Peter Marshall [this message]
2026-09-18 22:17 ` [PATCH 07/11] media: i2c: st-vd55g1: Clean up module error reporting Peter Marshall
2026-09-18 22:17 ` [PATCH 08/11] media: i2c: st-vd55g1: Unify frame timing calculations Peter Marshall
2026-09-18 22:17 ` [PATCH 09/11] media: i2c: st-vd55g1: Abstract sensor models, revisions, and features Peter Marshall
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=20260918221705.323510-7-pm@petermarshall.ca \
--to=pm@petermarshall.ca \
--cc=benjamin.mugnier@foss.st.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=sylvain.petinot@foss.st.com \
/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
all inboxes | Powered by JetHome®