From: Axel Lin Date: Wed, 16 Nov 2011 08:14:03 +0000 (-0300) Subject: [media] media/radio/tef6862: fix checking return value of i2c_master_send X-Git-Tag: next-20111128~55^2~2^2~69 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=bd93b3ad275501f50935a420cb26f598093d91a0;p=karo-tx-linux.git [media] media/radio/tef6862: fix checking return value of i2c_master_send i2c_master_send returns negative errno, or else the number of bytes written. Signed-off-by: Axel Lin Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/radio/tef6862.c b/drivers/media/radio/tef6862.c index 0991e1973678..3408685b690c 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)