[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 <axel.lin@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Axel Lin 2011-11-16 05:14:03 -03:00 committed by Mauro Carvalho Chehab
parent affc9a0d59
commit bd93b3ad27
1 changed files with 5 additions and 3 deletions

View File

@ -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)