summaryrefslogtreecommitdiff
path: root/drivers/media/platform/davinci/vpbe.c
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2016-10-11 04:40:41 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-11-16 12:19:15 -0200
commitf42afd29e60585904fc5127862263437ed7cbbd5 (patch)
tree94359a247a7287b5dbe911e0bb1e03fa3697ba50 /drivers/media/platform/davinci/vpbe.c
parente44e9489a7bda01bb26986fdf5b17559d26c26af (diff)
[media] DaVinci-VPBE: Use kmalloc_array() in vpbe_initialize()
* 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/vpbe.c')
-rw-r--r--drivers/media/platform/davinci/vpbe.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index 7d2670732805..785d6cf93152 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -676,9 +676,9 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)
* store venc sd index.
*/
num_encoders = vpbe_dev->cfg->num_ext_encoders + 1;
- vpbe_dev->encoders = kmalloc(
- sizeof(struct v4l2_subdev *)*num_encoders,
- GFP_KERNEL);
+ vpbe_dev->encoders = kmalloc_array(num_encoders,
+ sizeof(*vpbe_dev->encoders),
+ GFP_KERNEL);
if (NULL == vpbe_dev->encoders) {
v4l2_err(&vpbe_dev->v4l2_dev,
"unable to allocate memory for encoders sub devices");