Commit f42afd29 authored by Markus Elfring's avatar Markus Elfring Committed by Mauro Carvalho Chehab

[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: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent e44e9489
...@@ -676,8 +676,8 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev) ...@@ -676,8 +676,8 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)
* store venc sd index. * store venc sd index.
*/ */
num_encoders = vpbe_dev->cfg->num_ext_encoders + 1; num_encoders = vpbe_dev->cfg->num_ext_encoders + 1;
vpbe_dev->encoders = kmalloc( vpbe_dev->encoders = kmalloc_array(num_encoders,
sizeof(struct v4l2_subdev *)*num_encoders, sizeof(*vpbe_dev->encoders),
GFP_KERNEL); GFP_KERNEL);
if (NULL == vpbe_dev->encoders) { if (NULL == vpbe_dev->encoders) {
v4l2_err(&vpbe_dev->v4l2_dev, v4l2_err(&vpbe_dev->v4l2_dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment