diff options
author | Hans de Goede <hdegoede@redhat.com> | 2023-12-04 13:39:40 +0100 |
---|---|---|
committer | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2023-12-13 13:21:20 +0100 |
commit | 47913c1f554c31350af36130b208a0bf7754e8d0 (patch) | |
tree | fee165c494f8a80052bef8ab43f3b7fc48efd51c /drivers/media/i2c/ov2740.c | |
parent | 846a37cf470f489ad1713e143083d17630c73056 (diff) | |
download | lwn-47913c1f554c31350af36130b208a0bf7754e8d0.tar.gz lwn-47913c1f554c31350af36130b208a0bf7754e8d0.zip |
media: ov2740: Move fwnode_graph_get_next_endpoint() call up
If the bridge has not yet setup the fwnode-graph then
the fwnode_property_read_u32("clock-frequency") call will fail.
Move the fwnode_graph_get_next_endpoint() call to above reading
the clock-frequency.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media/i2c/ov2740.c')
-rw-r--r-- | drivers/media/i2c/ov2740.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c index 653cd96bb156..06427e886d15 100644 --- a/drivers/media/i2c/ov2740.c +++ b/drivers/media/i2c/ov2740.c @@ -929,18 +929,26 @@ static int ov2740_check_hwcfg(struct device *dev) int ret; unsigned int i, j; + /* + * Sometimes the fwnode graph is initialized by the bridge driver, + * wait for this. + */ + ep = fwnode_graph_get_next_endpoint(fwnode, NULL); + if (!ep) + return -EPROBE_DEFER; + ret = fwnode_property_read_u32(fwnode, "clock-frequency", &mclk); - if (ret) + if (ret) { + fwnode_handle_put(ep); return ret; + } - if (mclk != OV2740_MCLK) + if (mclk != OV2740_MCLK) { + fwnode_handle_put(ep); return dev_err_probe(dev, -EINVAL, "external clock %d is not supported\n", mclk); - - ep = fwnode_graph_get_next_endpoint(fwnode, NULL); - if (!ep) - return -EPROBE_DEFER; + } ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg); fwnode_handle_put(ep); |