public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [media] media/radio/tef6862: fix checking return value of i2c_master_send
@ 2011-11-16  9:14 Axel Lin
  0 siblings, 0 replies; only message in thread
From: Axel Lin @ 2011-11-16  9:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Richard Röjfors, Mauro Carvalho Chehab Mauro Carvalho Chehab,
	Herton Ronaldo Krzesinski, linux-media

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

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/media/radio/tef6862.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/media/radio/tef6862.c b/drivers/media/radio/tef6862.c
index 0991e19..3408685 100644
--- a/drivers/media/radio/tef6862.c
+++ b/drivers/media/radio/tef6862.c
@@ -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)
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-16  9:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-16  9:14 [PATCH] [media] media/radio/tef6862: fix checking return value of i2c_master_send Axel Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox