[PATCH 11/13] media: i2c: ds90ub960: Handle errors in ub960_log_status_ub960_sp_eq()

Tomi Valkeinen posted 13 patches 1 month, 3 weeks ago
There is a newer version of this series
[PATCH 11/13] media: i2c: ds90ub960: Handle errors in ub960_log_status_ub960_sp_eq()
Posted by Tomi Valkeinen 1 month, 3 weeks ago
Add error handling for i2c read/write calls to
ub960_log_status_ub960_sp_eq()

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/media/i2c/ds90ub960.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c
index ab5330db4162..47990aa1f007 100644
--- a/drivers/media/i2c/ds90ub960.c
+++ b/drivers/media/i2c/ds90ub960.c
@@ -2977,17 +2977,22 @@ static void ub960_log_status_ub960_sp_eq(struct ub960_data *priv,
 	u8 eq_level;
 	s8 strobe_pos;
 	u8 v = 0;
+	int ret;
 
 	/* Strobe */
 
-	ub960_read(priv, UB960_XR_AEQ_CTL1, &v);
+	ret = ub960_read(priv, UB960_XR_AEQ_CTL1, &v);
+	if (ret)
+		return;
 
 	dev_info(dev, "\t%s strobe\n",
 		 (v & UB960_XR_AEQ_CTL1_AEQ_SFILTER_EN) ? "Adaptive" :
 							  "Manual");
 
 	if (v & UB960_XR_AEQ_CTL1_AEQ_SFILTER_EN) {
-		ub960_read(priv, UB960_XR_SFILTER_CFG, &v);
+		ret = ub960_read(priv, UB960_XR_SFILTER_CFG, &v);
+		if (ret)
+			return;
 
 		dev_info(dev, "\tStrobe range [%d, %d]\n",
 			 ((v >> UB960_XR_SFILTER_CFG_SFILTER_MIN_SHIFT) & 0xf) -
@@ -2996,20 +3001,26 @@ static void ub960_log_status_ub960_sp_eq(struct ub960_data *priv,
 				 7);
 	}
 
-	ub960_rxport_get_strobe_pos(priv, nport, &strobe_pos);
+	ret = ub960_rxport_get_strobe_pos(priv, nport, &strobe_pos);
+	if (ret)
+		return;
 
 	dev_info(dev, "\tStrobe pos %d\n", strobe_pos);
 
 	/* EQ */
 
-	ub960_rxport_read(priv, nport, UB960_RR_AEQ_BYPASS, &v);
+	ret = ub960_rxport_read(priv, nport, UB960_RR_AEQ_BYPASS, &v);
+	if (ret)
+		return;
 
 	dev_info(dev, "\t%s EQ\n",
 		 (v & UB960_RR_AEQ_BYPASS_ENABLE) ? "Manual" :
 						    "Adaptive");
 
 	if (!(v & UB960_RR_AEQ_BYPASS_ENABLE)) {
-		ub960_rxport_read(priv, nport, UB960_RR_AEQ_MIN_MAX, &v);
+		ret = ub960_rxport_read(priv, nport, UB960_RR_AEQ_MIN_MAX, &v);
+		if (ret)
+			return;
 
 		dev_info(dev, "\tEQ range [%u, %u]\n",
 			 (v >> UB960_RR_AEQ_MIN_MAX_AEQ_FLOOR_SHIFT) & 0xf,

-- 
2.43.0
Re: [PATCH 11/13] media: i2c: ds90ub960: Handle errors in ub960_log_status_ub960_sp_eq()
Posted by Andy Shevchenko 1 month, 2 weeks ago
On Fri, Oct 04, 2024 at 05:46:42PM +0300, Tomi Valkeinen wrote:
> Add error handling for i2c read/write calls to
> ub960_log_status_ub960_sp_eq()

Missed period.

...

>  	u8 eq_level;
>  	s8 strobe_pos;
>  	u8 v = 0;

With that change in place you may remove redundant assignments to 0 here
and everywhere else where is not needed anymore.

> +	int ret;
>  
>  	/* Strobe */
>  
> -	ub960_read(priv, UB960_XR_AEQ_CTL1, &v);
> +	ret = ub960_read(priv, UB960_XR_AEQ_CTL1, &v);
> +	if (ret)
> +		return;

-- 
With Best Regards,
Andy Shevchenko