]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
[media] media/radio/tef6862: fix checking return value of i2c_master_send
authorAxel Lin <axel.lin@gmail.com>
Wed, 16 Nov 2011 08:14:03 +0000 (05:14 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 24 Nov 2011 20:22:22 +0000 (18:22 -0200)
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>
drivers/media/radio/tef6862.c

index 0991e1973678ce0751c455cb85249264935415fb..3408685b690c74406b690ea101992563028169f1 100644 (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)