[PATCH 06/11] media: i2c: st,vd55g1: Handle virtual firmware graph endpoints
From: Peter Marshall
Date: Fri Sep 18 2026 - 18:22:38 EST
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@xxxxxxxxxxxxxxxx>
---
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