diff options
author | Benoit Taine <benoit.taine@lip6.fr> | 2014-05-26 11:21:26 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-04 14:34:21 -0400 |
commit | 20f63150a21598c38e2f32cedb235319b99436f8 (patch) | |
tree | 1ba50df9964f05f92ff11b6b2e5a4137b7e2ac98 | |
parent | 690130fe0b4c1a72c931e9aafbec8f21dbeed20c (diff) |
[media] drx-j: Use kmemdup instead of kmalloc + memcpy
This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/memdup.cocci
Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r-- | drivers/media/dvb-frontends/drx39xyj/drxj.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c index 9482954fd453..3795f65564f8 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drxj.c +++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c | |||
@@ -12272,22 +12272,20 @@ struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c) | |||
12272 | if (demod == NULL) | 12272 | if (demod == NULL) |
12273 | goto error; | 12273 | goto error; |
12274 | 12274 | ||
12275 | demod_addr = kmalloc(sizeof(struct i2c_device_addr), GFP_KERNEL); | 12275 | demod_addr = kmemdup(&drxj_default_addr_g, |
12276 | sizeof(struct i2c_device_addr), GFP_KERNEL); | ||
12276 | if (demod_addr == NULL) | 12277 | if (demod_addr == NULL) |
12277 | goto error; | 12278 | goto error; |
12278 | memcpy(demod_addr, &drxj_default_addr_g, | ||
12279 | sizeof(struct i2c_device_addr)); | ||
12280 | 12279 | ||
12281 | demod_comm_attr = kmalloc(sizeof(struct drx_common_attr), GFP_KERNEL); | 12280 | demod_comm_attr = kmemdup(&drxj_default_comm_attr_g, |
12281 | sizeof(struct drx_common_attr), GFP_KERNEL); | ||
12282 | if (demod_comm_attr == NULL) | 12282 | if (demod_comm_attr == NULL) |
12283 | goto error; | 12283 | goto error; |
12284 | memcpy(demod_comm_attr, &drxj_default_comm_attr_g, | ||
12285 | sizeof(struct drx_common_attr)); | ||
12286 | 12284 | ||
12287 | demod_ext_attr = kmalloc(sizeof(struct drxj_data), GFP_KERNEL); | 12285 | demod_ext_attr = kmemdup(&drxj_data_g, sizeof(struct drxj_data), |
12286 | GFP_KERNEL); | ||
12288 | if (demod_ext_attr == NULL) | 12287 | if (demod_ext_attr == NULL) |
12289 | goto error; | 12288 | goto error; |
12290 | memcpy(demod_ext_attr, &drxj_data_g, sizeof(struct drxj_data)); | ||
12291 | 12289 | ||
12292 | /* setup the state */ | 12290 | /* setup the state */ |
12293 | state->i2c = i2c; | 12291 | state->i2c = i2c; |