diff mbox series

[4/4] media: hi556: Don't log hi556_check_hwcfg() errors twice

Message ID 20241219192733.45659-4-hdegoede@redhat.com (mailing list archive)
State New
Headers show
Series [1/4] media: hi556: Fix memory leak (on error) in hi556_check_hwcfg() | expand

Commit Message

Hans de Goede Dec. 19, 2024, 7:27 p.m. UTC
All hi556_check_hwcfg() error-exit paths already log a detailed reason,
logging a second generic "failed to check HW configuration" error is not
useful, and in case of the fwnode check failing with -EPROBE_DEFER this
is outright problematic flooding the log with:

[    6.336318] hi556 i2c-INT3537:00: failed to check HW configuration: -517
[    6.339006] hi556 i2c-INT3537:00: failed to check HW configuration: -517
[    6.346293] hi556 i2c-INT3537:00: failed to check HW configuration: -517
[    6.356129] hi556 i2c-INT3537:00: failed to check HW configuration: -517
[    6.380316] hi556 i2c-INT3537:00: failed to check HW configuration: -517
etc.

The one exception to all hi556_check_hwcfg() error-exit paths already
logging an error is on v4l2_fwnode_endpoint_alloc_parse() errors.

Make hi556_check_hwcfg() log an error in that case too and drop
the duplicate "failed to check HW configuration" error logging.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=2307279
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/media/i2c/hi556.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/i2c/hi556.c b/drivers/media/i2c/hi556.c
index 57c51d0e9c4e..9b5b657f75f9 100644
--- a/drivers/media/i2c/hi556.c
+++ b/drivers/media/i2c/hi556.c
@@ -1226,7 +1226,7 @@  static int hi556_check_hwcfg(struct device *dev)
 	ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg);
 	fwnode_handle_put(ep);
 	if (ret)
-		return ret;
+		return dev_err_probe(dev, ret, "parsing endpoint failed\n");
 
 	ret = fwnode_property_read_u32(fwnode, "clock-frequency", &mclk);
 	if (ret) {
@@ -1334,11 +1334,8 @@  static int hi556_probe(struct i2c_client *client)
 	int ret;
 
 	ret = hi556_check_hwcfg(&client->dev);
-	if (ret) {
-		dev_err(&client->dev, "failed to check HW configuration: %d\n",
-			ret);
+	if (ret)
 		return ret;
-	}
 
 	hi556 = devm_kzalloc(&client->dev, sizeof(*hi556), GFP_KERNEL);
 	if (!hi556)