diff options
author | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-09-03 14:55:19 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-09-03 17:58:30 -0300 |
commit | 93623c87a38533be4d8a636f29e58dbd01d3841b (patch) | |
tree | 3ca499f475a3db89514935294515d03dd9b128d3 /drivers/media/platform | |
parent | a7459a9d3ab932209e3340d5ae4dadf73147e8d5 (diff) | |
download | linux-93623c87a38533be4d8a636f29e58dbd01d3841b.tar.bz2 |
[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: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r-- | drivers/media/platform/soc_camera/soc_camera.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index f4308fed5431..ee8cdc95a9f9 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -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 |