diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2016-10-12 15:30:44 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-11-16 16:01:44 +0100 |
commit | d5cf467ecec5a3924a602018c6e405ad6d0dbecc (patch) | |
tree | 3cd2c5625d97cb770bbed65f15abe081f388b893 | |
parent | [media] DaVinci-VPIF-Capture: Delete an unnecessary variable initialisation i... (diff) | |
download | linux-d5cf467ecec5a3924a602018c6e405ad6d0dbecc.tar.xz linux-d5cf467ecec5a3924a602018c6e405ad6d0dbecc.zip |
[media] DaVinci-VPIF-Display: Use kcalloc() in vpif_probe()
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data type by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
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>
-rw-r--r-- | drivers/media/platform/davinci/vpif_display.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index 6b3ea1e8e97f..0faab86db9a1 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c @@ -1274,8 +1274,7 @@ static __init int vpif_probe(struct platform_device *pdev) vpif_obj.config = pdev->dev.platform_data; subdev_count = vpif_obj.config->subdev_count; subdevdata = vpif_obj.config->subdevinfo; - vpif_obj.sd = kzalloc(sizeof(struct v4l2_subdev *) * subdev_count, - GFP_KERNEL); + vpif_obj.sd = kcalloc(subdev_count, sizeof(*vpif_obj.sd), GFP_KERNEL); if (vpif_obj.sd == NULL) { vpif_err("unable to allocate memory for subdevice pointers\n"); err = -ENOMEM; |