Skip to contentSkip to conversation

media/radio/tef6862: fix checking return value of i2c_master_send

PATCH New Axel Lin 1 participant 1 message Nov 16, 2011 Media (V4L/DVB)

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 media/radio/tef6862: fix checking return value of i2c_master_send

i2c_master_send returns negative errno, or else the number of bytes written.

---
 drivers/media/radio/tef6862.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/media/radio/tef6862.c +5 -3
index 0991e19..3408685 100644
@@ -118,9 +118,11 @@ static int tef6862_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f)
 	i2cmsg[2] = pll & 0xff;
 
 	err = i2c_master_send(client, i2cmsg, sizeof(i2cmsg));
-	if (!err)
-		state->freq = f->frequency;
-	return err;
+	if (err != sizeof(i2cmsg))
+		return err < 0 ? err : -EIO;
+
+	state->freq = f->frequency;
+	return 0;
 }
 
 static int tef6862_g_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f)
Signature · 1 line
1.7.5.4