Skip to content

Commit

Permalink
[media] media/radio/tef6862: fix checking return value of i2c_master_…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Axel Lin authored and Mauro Carvalho Chehab committed Nov 24, 2011
1 parent affc9a0 commit bd93b3a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/media/radio/tef6862.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bd93b3a

Please sign in to comment.