This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: ov2740: Move fwnode_graph_get_next_endpoint() call up
Author:  Hans de Goede <hdego...@redhat.com>
Date:    Mon Dec 4 13:39:40 2023 +0100

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 <hdego...@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ai...@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl>

 drivers/media/i2c/ov2740.c | 20 ++++++++++++++------
 1 file 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);

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to