summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/davinci/vpfe_capture.c
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2016-10-12 05:20:02 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-11-16 12:42:05 -0200
commited011a23c90796c386ae7004ef0823ade6583d21 (patch)
tree08e619d50567b89b7808ada7298fbc1d4185d7e1 /drivers/media/platform/davinci/vpfe_capture.c
parent630bf79a455bbb5fd13e7721280cd149860bcd56 (diff)
downloadlinux-ed011a23c90796c386ae7004ef0823ade6583d21.tar.bz2
[media] DaVinci-VPFE-Capture: Use kmalloc_array() in vpfe_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 "kmalloc_array". 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>
Diffstat (limited to 'drivers/media/platform/davinci/vpfe_capture.c')
-rw-r--r--drivers/media/platform/davinci/vpfe_capture.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
index ca22c3493f55..a9bc35e785a3 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -1938,8 +1938,9 @@ static int vpfe_probe(struct platform_device *pdev)
video_set_drvdata(&vpfe_dev->video_dev, vpfe_dev);
i2c_adap = i2c_get_adapter(vpfe_cfg->i2c_adapter_id);
num_subdevs = vpfe_cfg->num_subdevs;
- vpfe_dev->sd = kmalloc(sizeof(struct v4l2_subdev *) * num_subdevs,
- GFP_KERNEL);
+ vpfe_dev->sd = kmalloc_array(num_subdevs,
+ sizeof(*vpfe_dev->sd),
+ GFP_KERNEL);
if (NULL == vpfe_dev->sd) {
v4l2_err(&vpfe_dev->v4l2_dev,
"unable to allocate memory for subdevice pointers\n");