diff mbox series

[6/8] media: ov08x40: Improve ov08x40_identify_module() error logging

Message ID 20241219134940.15472-7-hdegoede@redhat.com (mailing list archive)
State New
Headers show
Series media: ov08x40: Various improvements | expand

Commit Message

Hans de Goede Dec. 19, 2024, 1:49 p.m. UTC
ov08x40_identify_module() already logs an error if the read ID mismatches,
so having its caller also log an error results in 2 errors in this case.

Add error logging to the ID register read in ov08x40_identify_module() and
drop the error logging in the caller.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/media/i2c/ov08x40.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Bryan O'Donoghue Dec. 20, 2024, 2:31 p.m. UTC | #1
On 19/12/2024 13:49, Hans de Goede wrote:
> ov08x40_identify_module() already logs an error if the read ID mismatches,
> so having its caller also log an error results in 2 errors in this case.
> 
> Add error logging to the ID register read in ov08x40_identify_module() and
> drop the error logging in the caller.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
diff mbox series

Patch

diff --git a/drivers/media/i2c/ov08x40.c b/drivers/media/i2c/ov08x40.c
index 44989a37c2f3..ca004343a9d8 100644
--- a/drivers/media/i2c/ov08x40.c
+++ b/drivers/media/i2c/ov08x40.c
@@ -1943,8 +1943,10 @@  static int ov08x40_identify_module(struct ov08x40 *ov08x)
 
 	ret = ov08x40_read_reg(ov08x, OV08X40_REG_CHIP_ID,
 			       OV08X40_REG_VALUE_24BIT, &val);
-	if (ret)
+	if (ret) {
+		dev_err(&client->dev, "error reading chip-id register: %d\n", ret);
 		return ret;
+	}
 
 	if (val != OV08X40_CHIP_ID) {
 		dev_err(&client->dev, "chip id mismatch: %x!=%x\n",
@@ -2262,10 +2264,8 @@  static int ov08x40_probe(struct i2c_client *client)
 
 		/* Check module identity */
 		ret = ov08x40_identify_module(ov08x);
-		if (ret) {
-			dev_err(&client->dev, "failed to find sensor: %d\n", ret);
+		if (ret)
 			goto probe_power_off;
-		}
 	}
 
 	/* Set default mode to max resolution */