[media] go7007: don't use vb before test if it is not NULL
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 28 Apr 2015 20:09:23 +0000 (17:09 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 30 Apr 2015 16:41:03 +0000 (13:41 -0300)
As reported by smatch:
drivers/media/usb/go7007/go7007-driver.c:452 frame_boundary() warn: variable dereferenced before check 'vb' (see line 449)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/usb/go7007/go7007-driver.c

index 95cffb771a62e91c23e062276619f44ce183f688..0ab81ec8897acc0bf8165fe5947294975b46d0f3 100644 (file)
@@ -446,7 +446,7 @@ static void go7007_motion_regions(struct go7007 *go, struct go7007_buffer *vb)
  */
 static struct go7007_buffer *frame_boundary(struct go7007 *go, struct go7007_buffer *vb)
 {
-       u32 *bytesused = &vb->vb.v4l2_planes[0].bytesused;
+       u32 *bytesused;
        struct go7007_buffer *vb_tmp = NULL;
 
        if (vb == NULL) {
@@ -458,6 +458,7 @@ static struct go7007_buffer *frame_boundary(struct go7007 *go, struct go7007_buf
                go->next_seq++;
                return vb;
        }
+       bytesused = &vb->vb.v4l2_planes[0].bytesused;
 
        vb->vb.v4l2_buf.sequence = go->next_seq++;
        if (vb->modet_active && *bytesused + 216 < GO7007_BUF_SIZE)