diff mbox series

[1/1] media: tc358743: Add error code to error message

Message ID 20230425073346.636871-1-alexander.stein@ew.tq-group.com
State Accepted
Commit fae4280ece942b7c02be6d9bcce2873cdea32fe7
Headers show
Series [1/1] media: tc358743: Add error code to error message | expand

Commit Message

Alexander Stein April 25, 2023, 7:33 a.m. UTC
Add the error code of a failed i2c transfer to the error message.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 drivers/media/i2c/tc358743.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Kieran Bingham April 29, 2023, 10:44 p.m. UTC | #1
Quoting Alexander Stein (2023-04-25 08:33:46)
> Add the error code of a failed i2c transfer to the error message.
> 
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
>  drivers/media/i2c/tc358743.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
> index 9197fa0b1bc2..ad6a72b2bcf5 100644
> --- a/drivers/media/i2c/tc358743.c
> +++ b/drivers/media/i2c/tc358743.c
> @@ -133,8 +133,8 @@ static void i2c_rd(struct v4l2_subdev *sd, u16 reg, u8 *values, u32 n)
>  
>         err = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
>         if (err != ARRAY_SIZE(msgs)) {
> -               v4l2_err(sd, "%s: reading register 0x%x from 0x%x failed\n",
> -                               __func__, reg, client->addr);
> +               v4l2_err(sd, "%s: reading register 0x%x from 0x%x failed: %d\n",

Hrm. I was going to ask if %pe [0] would be relevant to print the error, but
these aren't quite PTR_ERR's ... just errors... Though it looks from
lib/vscnprintf.c :: err_ptr() it would still work!

[0] https://www.kernel.org/doc/html/latest/core-api/printk-formats.html#error-pointers

So either way,

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> +                               __func__, reg, client->addr, err);
>         }
>  }
>  
> @@ -165,8 +165,8 @@ static void i2c_wr(struct v4l2_subdev *sd, u16 reg, u8 *values, u32 n)
>  
>         err = i2c_transfer(client->adapter, &msg, 1);
>         if (err != 1) {
> -               v4l2_err(sd, "%s: writing register 0x%x from 0x%x failed\n",
> -                               __func__, reg, client->addr);
> +               v4l2_err(sd, "%s: writing register 0x%x from 0x%x failed: %d\n",
> +                               __func__, reg, client->addr, err);
>                 return;
>         }
>  
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index 9197fa0b1bc2..ad6a72b2bcf5 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -133,8 +133,8 @@  static void i2c_rd(struct v4l2_subdev *sd, u16 reg, u8 *values, u32 n)
 
 	err = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
 	if (err != ARRAY_SIZE(msgs)) {
-		v4l2_err(sd, "%s: reading register 0x%x from 0x%x failed\n",
-				__func__, reg, client->addr);
+		v4l2_err(sd, "%s: reading register 0x%x from 0x%x failed: %d\n",
+				__func__, reg, client->addr, err);
 	}
 }
 
@@ -165,8 +165,8 @@  static void i2c_wr(struct v4l2_subdev *sd, u16 reg, u8 *values, u32 n)
 
 	err = i2c_transfer(client->adapter, &msg, 1);
 	if (err != 1) {
-		v4l2_err(sd, "%s: writing register 0x%x from 0x%x failed\n",
-				__func__, reg, client->addr);
+		v4l2_err(sd, "%s: writing register 0x%x from 0x%x failed: %d\n",
+				__func__, reg, client->addr, err);
 		return;
 	}