Commit 93623c87 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] soc_camera: use kmemdup()

Instead of calling kzalloc and then copying, use kmemdup(). That
avoids zeroing the data structure before copying.

Found by coccinelle.
Acked-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent a7459a9d
...@@ -1347,13 +1347,11 @@ static int soc_camera_i2c_init(struct soc_camera_device *icd, ...@@ -1347,13 +1347,11 @@ static int soc_camera_i2c_init(struct soc_camera_device *icd,
return -ENODEV; return -ENODEV;
} }
ssdd = kzalloc(sizeof(*ssdd), GFP_KERNEL); ssdd = kmemdup(&sdesc->subdev_desc, sizeof(*ssdd), GFP_KERNEL);
if (!ssdd) { if (!ssdd) {
ret = -ENOMEM; ret = -ENOMEM;
goto ealloc; goto ealloc;
} }
memcpy(ssdd, &sdesc->subdev_desc, sizeof(*ssdd));
/* /*
* In synchronous case we request regulators ourselves in * In synchronous case we request regulators ourselves in
* soc_camera_pdrv_probe(), make sure the subdevice driver doesn't try * soc_camera_pdrv_probe(), make sure the subdevice driver doesn't try
......
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