Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: greybus: camera: Use kcalloc for array's memory allocation.

Fix checkpatch warning:

WARNING: Prefer kcalloc over kzalloc with multiply

kcalloc is designed to allocate memory for arrays, its use is
preferable than kzalloc in these cases.

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Elise Lennion and committed by
Greg Kroah-Hartman
c4fc2ebc 9d3318f4

+2 -2
+2 -2
drivers/staging/greybus/camera.c
··· 797 797 if (gb_nstreams > GB_CAMERA_MAX_STREAMS) 798 798 return -EINVAL; 799 799 800 - gb_streams = kzalloc(gb_nstreams * sizeof(*gb_streams), GFP_KERNEL); 800 + gb_streams = kcalloc(gb_nstreams, sizeof(*gb_streams), GFP_KERNEL); 801 801 if (!gb_streams) 802 802 return -ENOMEM; 803 803 ··· 938 938 return ret; 939 939 940 940 /* For each stream to configure parse width, height and format */ 941 - streams = kzalloc(nstreams * sizeof(*streams), GFP_KERNEL); 941 + streams = kcalloc(nstreams, sizeof(*streams), GFP_KERNEL); 942 942 if (!streams) 943 943 return -ENOMEM; 944 944