Skip to contentSkip to conversation

media: i2c: imx415: Fix control error handling

PATCH In review Narasimharao Vadlamudi 3 participants 3 messages Jul 31 – Aug 3

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: i2c: imx415: Fix control error handling

imx415_set_testpattern() accumulates failures from cci_write(), but drops the value and always returns success. Return the accumulated error so V4L2 reports failures to userspace.

The VBLANK path also returned immediately when programming VMAX failed after pm_runtime_get_if_in_use() had taken a runtime PM reference. Break out of the switch instead so the common pm_runtime_put() path is used.

Fixes d5df1c7f3f83 ("media: i2c: imx415: Convert to new CCI register access helpers")
Fixes 3bcae55ab96a ("media: i2c: imx415: Add read/write control of VBLANK")
---
 drivers/media/i2c/imx415.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/imx415.c +2 -2
index 0b424c17e880..c3b22b238ea0 100644
@@ -686,7 +686,7 @@ static int imx415_set_testpattern(struct imx415 *sensor, int val)
 		cci_write(sensor->regmap, IMX415_DIG_CLP_MODE, 0x01, &ret);
 		cci_write(sensor->regmap, IMX415_WRJ_OPEN, 0x01, &ret);
 	}
-	return 0;
+	return ret;
 }
 
 static int imx415_s_ctrl(struct v4l2_ctrl *ctrl)
@@ -720,7 +720,7 @@ static int imx415_s_ctrl(struct v4l2_ctrl *ctrl)
 		ret = cci_write(sensor->regmap, IMX415_VMAX,
 				format->height + ctrl->val, NULL);
 		if (ret)
-			return ret;
+			break;
 		/*
 		 * Exposure is set based on VMAX which has just changed, so
 		 * program exposure register as well
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi Narasimharao Vadlamudi,

Thanks for the patch!

Quoted 11 lines · Narasimharao Vadlamudi

imx415_set_testpattern() accumulates failures from cci_write(), but drops the value and always returns success. Return the accumulated error so V4L2 reports failures to userspace.

The VBLANK path also returned immediately when programming VMAX failed after pm_runtime_get_if_in_use() had taken a runtime PM reference. Break out of the switch instead so the common pm_runtime_put() path is used.

Fixes d5df1c7f3f83 ("media: i2c: imx415: Convert to new CCI register access helpers")
Fixes 3bcae55ab96a ("media: i2c: imx415: Add read/write control of VBLANK")

Best regards,
Michael

Quoted 26 lines
---
 drivers/media/i2c/imx415.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/imx415.c +2 -2
index 0b424c17e880..c3b22b238ea0 100644
@@ -686,7 +686,7 @@ static int imx415_set_testpattern(struct imx415 *sensor, int val)
 		cci_write(sensor->regmap, IMX415_DIG_CLP_MODE, 0x01, &ret);
 		cci_write(sensor->regmap, IMX415_WRJ_OPEN, 0x01, &ret);
 	}
-	return 0;
+	return ret;
 }
 
 static int imx415_s_ctrl(struct v4l2_ctrl *ctrl)
@@ -720,7 +720,7 @@ static int imx415_s_ctrl(struct v4l2_ctrl *ctrl)
 		ret = cci_write(sensor->regmap, IMX415_VMAX,
 				format->height + ctrl->val, NULL);
 		if (ret)
-			return ret;
+			break;
 		/*
 		 * Exposure is set based on VMAX which has just changed, so
 		 * program exposure register as well
#2 lore raw
In reply to Narasimharao Vadlamudi

Hello Narasimharao

Quoted 8 lines · Narasimharao Vadlamudi

imx415_set_testpattern() accumulates failures from cci_write(), but drops the value and always returns success. Return the accumulated error so V4L2 reports failures to userspace.

The VBLANK path also returned immediately when programming VMAX failed after pm_runtime_get_if_in_use() had taken a runtime PM reference. Break out of the switch instead so the common pm_runtime_put() path is used.

These seems to be two separate issue worth two differnt patches ?

Quoted 2 lines
Fixes d5df1c7f3f83 ("media: i2c: imx415: Convert to new CCI register access helpers")
Fixes 3bcae55ab96a ("media: i2c: imx415: Add read/write control of VBLANK")

The double Fixes tag seems to suggest that

Also, Fixes commit need

Quoted 1 line

Thanks
j

Quoted 30 lines
---
 drivers/media/i2c/imx415.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/imx415.c +2 -3
index 0b424c17e880..c3b22b238ea0 100644
@@ -686,7 +686,7 @@ static int imx415_set_testpattern(struct imx415 *sensor, int val)
 		cci_write(sensor->regmap, IMX415_DIG_CLP_MODE, 0x01, &ret);
 		cci_write(sensor->regmap, IMX415_WRJ_OPEN, 0x01, &ret);
 	}
-	return 0;
+	return ret;
 }
 
 static int imx415_s_ctrl(struct v4l2_ctrl *ctrl)
@@ -720,7 +720,7 @@ static int imx415_s_ctrl(struct v4l2_ctrl *ctrl)
 		ret = cci_write(sensor->regmap, IMX415_VMAX,
 				format->height + ctrl->val, NULL);
 		if (ret)
-			return ret;
+			break;
 		/*
 		 * Exposure is set based on VMAX which has just changed, so
 		 * program exposure register as well
--

2.43.0