[PATCH] USB: kzalloc in usbvideo
another for kzalloc. Signed-off-by: Oliver Neukum <oliver@neukum.name> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
b10b417788
commit
51b208ddf6
|
@ -690,14 +690,13 @@ int usbvideo_register(
|
||||||
}
|
}
|
||||||
|
|
||||||
base_size = num_cams * sizeof(struct uvd) + sizeof(struct usbvideo);
|
base_size = num_cams * sizeof(struct uvd) + sizeof(struct usbvideo);
|
||||||
cams = (struct usbvideo *) kmalloc(base_size, GFP_KERNEL);
|
cams = (struct usbvideo *) kzalloc(base_size, GFP_KERNEL);
|
||||||
if (cams == NULL) {
|
if (cams == NULL) {
|
||||||
err("Failed to allocate %d. bytes for usbvideo struct", base_size);
|
err("Failed to allocate %d. bytes for usbvideo struct", base_size);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
dbg("%s: Allocated $%p (%d. bytes) for %d. cameras",
|
dbg("%s: Allocated $%p (%d. bytes) for %d. cameras",
|
||||||
__FUNCTION__, cams, base_size, num_cams);
|
__FUNCTION__, cams, base_size, num_cams);
|
||||||
memset(cams, 0, base_size);
|
|
||||||
|
|
||||||
/* Copy callbacks, apply defaults for those that are not set */
|
/* Copy callbacks, apply defaults for those that are not set */
|
||||||
memmove(&cams->cb, cbTbl, sizeof(cams->cb));
|
memmove(&cams->cb, cbTbl, sizeof(cams->cb));
|
||||||
|
|
Loading…
Reference in New Issue