bb5a2a6b1a3bff7823467e731f4857a9faf2c98d
[openwrt/staging/blocktrron.git] /
1 From 25b4bd6894bf79b5d6150d66222d63afea32f24f Mon Sep 17 00:00:00 2001
2 From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
3 Date: Sun, 16 Oct 2022 09:15:06 +0300
4 Subject: [PATCH] media: i2c: imx290: Print error code when I2C
5 transfer fails
6
7 Upstream commit fbe0a89dc7e3.
8
9 Knowing why I2C transfers fail is useful for debugging. Extend the error
10 message to print the error code.
11
12 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
13 Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
14 Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
15 ---
16 drivers/media/i2c/imx290.c | 6 ++++--
17 1 file changed, 4 insertions(+), 2 deletions(-)
18
19 --- a/drivers/media/i2c/imx290.c
20 +++ b/drivers/media/i2c/imx290.c
21 @@ -370,7 +370,8 @@ static inline int __always_unused imx290
22
23 ret = regmap_read(imx290->regmap, addr, &regval);
24 if (ret) {
25 - dev_err(imx290->dev, "I2C read failed for addr: %x\n", addr);
26 + dev_err(imx290->dev, "Failed to read register 0x%04x: %d\n",
27 + addr, ret);
28 return ret;
29 }
30
31 @@ -385,7 +386,8 @@ static int imx290_write_reg(struct imx29
32
33 ret = regmap_write(imx290->regmap, addr, value);
34 if (ret) {
35 - dev_err(imx290->dev, "I2C write failed for addr: %x\n", addr);
36 + dev_err(imx290->dev, "Failed to write register 0x%04x: %d\n",
37 + addr, ret);
38 return ret;
39 }
40