aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/media/se401.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/media/se401.c')
-rw-r--r--drivers/usb/media/se401.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/usb/media/se401.c b/drivers/usb/media/se401.c
index 2ba562285fda..f03ea7f89596 100644
--- a/drivers/usb/media/se401.c
+++ b/drivers/usb/media/se401.c
@@ -1157,21 +1157,21 @@ static int se401_mmap(struct file *file, struct vm_area_struct *vma)
1157 unsigned long size = vma->vm_end-vma->vm_start; 1157 unsigned long size = vma->vm_end-vma->vm_start;
1158 unsigned long page, pos; 1158 unsigned long page, pos;
1159 1159
1160 down(&se401->lock); 1160 mutex_lock(&se401->lock);
1161 1161
1162 if (se401->dev == NULL) { 1162 if (se401->dev == NULL) {
1163 up(&se401->lock); 1163 mutex_unlock(&se401->lock);
1164 return -EIO; 1164 return -EIO;
1165 } 1165 }
1166 if (size > (((SE401_NUMFRAMES * se401->maxframesize) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))) { 1166 if (size > (((SE401_NUMFRAMES * se401->maxframesize) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))) {
1167 up(&se401->lock); 1167 mutex_unlock(&se401->lock);
1168 return -EINVAL; 1168 return -EINVAL;
1169 } 1169 }
1170 pos = (unsigned long)se401->fbuf; 1170 pos = (unsigned long)se401->fbuf;
1171 while (size > 0) { 1171 while (size > 0) {
1172 page = vmalloc_to_pfn((void *)pos); 1172 page = vmalloc_to_pfn((void *)pos);
1173 if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) { 1173 if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) {
1174 up(&se401->lock); 1174 mutex_unlock(&se401->lock);
1175 return -EAGAIN; 1175 return -EAGAIN;
1176 } 1176 }
1177 start += PAGE_SIZE; 1177 start += PAGE_SIZE;
@@ -1181,7 +1181,7 @@ static int se401_mmap(struct file *file, struct vm_area_struct *vma)
1181 else 1181 else
1182 size = 0; 1182 size = 0;
1183 } 1183 }
1184 up(&se401->lock); 1184 mutex_unlock(&se401->lock);
1185 1185
1186 return 0; 1186 return 0;
1187} 1187}
@@ -1345,13 +1345,11 @@ static int se401_probe(struct usb_interface *intf,
1345 /* We found one */ 1345 /* We found one */
1346 info("SE401 camera found: %s", camera_name); 1346 info("SE401 camera found: %s", camera_name);
1347 1347
1348 if ((se401 = kmalloc(sizeof(*se401), GFP_KERNEL)) == NULL) { 1348 if ((se401 = kzalloc(sizeof(*se401), GFP_KERNEL)) == NULL) {
1349 err("couldn't kmalloc se401 struct"); 1349 err("couldn't kmalloc se401 struct");
1350 return -ENOMEM; 1350 return -ENOMEM;
1351 } 1351 }
1352 1352
1353 memset(se401, 0, sizeof(*se401));
1354
1355 se401->dev = dev; 1353 se401->dev = dev;
1356 se401->iface = interface->bInterfaceNumber; 1354 se401->iface = interface->bInterfaceNumber;
1357 se401->camera_name = camera_name; 1355 se401->camera_name = camera_name;
@@ -1366,7 +1364,7 @@ static int se401_probe(struct usb_interface *intf,
1366 memcpy(&se401->vdev, &se401_template, sizeof(se401_template)); 1364 memcpy(&se401->vdev, &se401_template, sizeof(se401_template));
1367 memcpy(se401->vdev.name, se401->camera_name, strlen(se401->camera_name)); 1365 memcpy(se401->vdev.name, se401->camera_name, strlen(se401->camera_name));
1368 init_waitqueue_head(&se401->wq); 1366 init_waitqueue_head(&se401->wq);
1369 init_MUTEX(&se401->lock); 1367 mutex_init(&se401->lock);
1370 wmb(); 1368 wmb();
1371 1369
1372 if (video_register_device(&se401->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { 1370 if (video_register_device(&se401->vdev, VFL_TYPE_GRABBER, video_nr) == -1) {