aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/usbvideo
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2010-03-12 04:15:32 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-17 23:47:16 -0400
commit728385c4d31469b9124953f36fb42015435466c9 (patch)
tree3c761c8d14c1983a24fca0e5bbc1443a97622cf8 /drivers/media/video/usbvideo
parent4e1af31aaaa8cc4a5cc1d894bdf04dfc7450d47f (diff)
V4L/DVB: drivers/media/video: move dereference after NULL test
In quickcam_messenger.c, if the NULL test on uvd is needed, then the dereference should be after the NULL test. In vpif_display.c, std_info is initialized to the address of a structure field. This seems unlikely to be NULL. Test std_info->stdid instead. In saa7134-alsa.c, the function is only called from one place, where the chip argument has already been dereferenced. On the other hand, if it should be kept, then card should be initialized after it. A simplified version of the semantic match that detects this problem is as follows (http://coccinelle.lip6.fr/): // <smpl> @match exists@ expression x, E; identifier fld; @@ * x->fld ... when != \(x = E\|&x\) * x == NULL // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: Muralidharan Karicheri <m-karicheri2@ti.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/usbvideo')
-rw-r--r--drivers/media/video/usbvideo/quickcam_messenger.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/video/usbvideo/quickcam_messenger.c b/drivers/media/video/usbvideo/quickcam_messenger.c
index fab48ec6c0ea..fbd665fa1979 100644
--- a/drivers/media/video/usbvideo/quickcam_messenger.c
+++ b/drivers/media/video/usbvideo/quickcam_messenger.c
@@ -693,12 +693,13 @@ static int qcm_start_data(struct uvd *uvd)
693 693
694static void qcm_stop_data(struct uvd *uvd) 694static void qcm_stop_data(struct uvd *uvd)
695{ 695{
696 struct qcm *cam = (struct qcm *) uvd->user_data; 696 struct qcm *cam;
697 int i, j; 697 int i, j;
698 int ret; 698 int ret;
699 699
700 if ((uvd == NULL) || (!uvd->streaming) || (uvd->dev == NULL)) 700 if ((uvd == NULL) || (!uvd->streaming) || (uvd->dev == NULL))
701 return; 701 return;
702 cam = (struct qcm *) uvd->user_data;
702 703
703 ret = qcm_camera_off(uvd); 704 ret = qcm_camera_off(uvd);
704 if (ret) 705 if (ret)