]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] blackfin-capture: Use kcalloc() in bcap_init_sensor_formats()
authorMarkus Elfring <elfring@users.sourceforge.net>
Sun, 9 Oct 2016 19:12:13 +0000 (16:12 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 16 Nov 2016 14:18:18 +0000 (12:18 -0200)
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus reuse the corresponding function "kcalloc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/blackfin/bfin_capture.c

index 8eb03397d736f2c9fa98d1380be8615530a79bad..c5e10439e8b9007465b507b47d94141543ab82d7 100644 (file)
@@ -169,7 +169,7 @@ static int bcap_init_sensor_formats(struct bcap_device *bcap_dev)
        if (!num_formats)
                return -ENXIO;
 
-       sf = kzalloc(num_formats * sizeof(*sf), GFP_KERNEL);
+       sf = kcalloc(num_formats, sizeof(*sf), GFP_KERNEL);
        if (!sf)
                return -ENOMEM;