[PATCH 3/6] [media] ds3000: properly report register read errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This brings both ds3000_readreg() and ds3000_tuner_readreg() in line
with ds3000_writereg() and ds3000_tuner_writereg() respectively.

Signed-off-by: Rémi Cardona <remi.cardona@xxxxxxxxxxxx>
---
 drivers/media/dvb/frontends/ds3000.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/media/dvb/frontends/ds3000.c b/drivers/media/dvb/frontends/ds3000.c
index 474f26e..6752222 100644
--- a/drivers/media/dvb/frontends/ds3000.c
+++ b/drivers/media/dvb/frontends/ds3000.c
@@ -340,7 +340,7 @@ static int ds3000_readreg(struct ds3000_state *state, u8 reg)
 
 	if (ret != 2) {
 		printk(KERN_ERR "%s: reg=0x%x(error=%d)\n", __func__, reg, ret);
-		return ret;
+		return -EREMOTEIO;
 	}
 
 	dprintk("%s: read reg 0x%02x, value 0x%02x\n", __func__, reg, b1[0]);
@@ -367,12 +367,15 @@ static int ds3000_tuner_readreg(struct ds3000_state *state, u8 reg)
 		}
 	};
 
-	ds3000_writereg(state, 0x03, 0x12);
-	ret = i2c_transfer(state->i2c, msg, 2);
+	ret = ds3000_writereg(state, 0x03, 0x12);
+	if (ret < 0) {
+		return -EREMOTEIO;
+	}
 
+	ret = i2c_transfer(state->i2c, msg, 2);
 	if (ret != 2) {
 		printk(KERN_ERR "%s: reg=0x%x(error=%d)\n", __func__, reg, ret);
-		return ret;
+		return -EREMOTEIO;
 	}
 
 	dprintk("%s: read reg 0x%02x, value 0x%02x\n", __func__, reg, b1[0]);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux