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,
return -ENODEV;
}
ssdd = kzalloc(sizeof(*ssdd), GFP_KERNEL);
ssdd = kmemdup(&sdesc->subdev_desc, sizeof(*ssdd), GFP_KERNEL);
if (!ssdd) {
ret = -ENOMEM;
goto ealloc;
}
memcpy(ssdd, &sdesc->subdev_desc, sizeof(*ssdd));
/*
* In synchronous case we request regulators ourselves in
* 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