Message ID | 20241012160803.75939-1-hdegoede@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | media: ov2740: Don't log ov2740_check_hwcfg() errors twice | expand |
Hans, Thanks for the patch. On 10/13/24 12:08 AM, Hans de Goede wrote: > All ov2740_check_hwcfg() error-exit paths already log a detailed reason, > logging a second generic "failed to check HW configuration" error is > not useful, drop this. > > The one exception is the -EPROBE_DEFER exit on > fwnode_graph_get_next_endpoint() returning NULL. > > Call dev_err_probe() there to register the reason for deferring the probe, > this is used if the endpoint is still not there after 30 seconds, e.g. : > > i2c-INT3474:00: deferred probe pending: waiting for fwnode graph endpoint > > Signed-off-by: Hans de Goede <hdegoede@redhat.com> > --- > drivers/media/i2c/ov2740.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c > index bd0b2f0f0d45..387c529d9736 100644 > --- a/drivers/media/i2c/ov2740.c > +++ b/drivers/media/i2c/ov2740.c > @@ -1132,7 +1132,8 @@ static int ov2740_check_hwcfg(struct device *dev) > */ > ep = fwnode_graph_get_next_endpoint(fwnode, NULL); > if (!ep) > - return -EPROBE_DEFER; > + return dev_err_probe(dev, -EPROBE_DEFER, > + "waiting for fwnode graph endpoint\n"); > > ret = fwnode_property_read_u32(fwnode, "clock-frequency", &mclk); > if (ret) { > @@ -1330,7 +1331,7 @@ static int ov2740_probe(struct i2c_client *client) > > ret = ov2740_check_hwcfg(dev); > if (ret) > - return dev_err_probe(dev, ret, "failed to check HW configuration\n"); > + return ret; > > ov2740->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); > if (IS_ERR(ov2740->reset_gpio)) { > Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c index bd0b2f0f0d45..387c529d9736 100644 --- a/drivers/media/i2c/ov2740.c +++ b/drivers/media/i2c/ov2740.c @@ -1132,7 +1132,8 @@ static int ov2740_check_hwcfg(struct device *dev) */ ep = fwnode_graph_get_next_endpoint(fwnode, NULL); if (!ep) - return -EPROBE_DEFER; + return dev_err_probe(dev, -EPROBE_DEFER, + "waiting for fwnode graph endpoint\n"); ret = fwnode_property_read_u32(fwnode, "clock-frequency", &mclk); if (ret) { @@ -1330,7 +1331,7 @@ static int ov2740_probe(struct i2c_client *client) ret = ov2740_check_hwcfg(dev); if (ret) - return dev_err_probe(dev, ret, "failed to check HW configuration\n"); + return ret; ov2740->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(ov2740->reset_gpio)) {
All ov2740_check_hwcfg() error-exit paths already log a detailed reason, logging a second generic "failed to check HW configuration" error is not useful, drop this. The one exception is the -EPROBE_DEFER exit on fwnode_graph_get_next_endpoint() returning NULL. Call dev_err_probe() there to register the reason for deferring the probe, this is used if the endpoint is still not there after 30 seconds, e.g. : i2c-INT3474:00: deferred probe pending: waiting for fwnode graph endpoint Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- drivers/media/i2c/ov2740.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)