aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends
diff options
context:
space:
mode:
authorEzequiel Garcia <elezegarcia@gmail.com>2012-10-23 14:57:24 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-12-27 16:03:15 -0500
commitee45ddc1e03afc221afad273503b6c2fc0683008 (patch)
treed3105d347e2817d1839dc1429cf3cc866dfadd5f /drivers/media/dvb-frontends
parentb9b1b3a8f7b76035140912bc9e3a325e58fc6d58 (diff)
[media] dvb-frontends: Replace memcpy with struct assignment
This kind of memcpy() is error-prone. Its replacement with a struct assignment is prefered because it's type-safe and much easier to read. Found by coccinelle. Hand patched and reviewed. Tested by compilation only. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ identifier struct_name; struct struct_name to; struct struct_name from; expression E; @@ -memcpy(&(to), &(from), E); +to = from; // </smpl> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb-frontends')
-rw-r--r--drivers/media/dvb-frontends/cx24116.c2
-rw-r--r--drivers/media/dvb-frontends/drxd_hard.c5
-rw-r--r--drivers/media/dvb-frontends/stv0299.c2
3 files changed, 4 insertions, 5 deletions
diff --git a/drivers/media/dvb-frontends/cx24116.c b/drivers/media/dvb-frontends/cx24116.c
index b48879186537..2916d7c74a1d 100644
--- a/drivers/media/dvb-frontends/cx24116.c
+++ b/drivers/media/dvb-frontends/cx24116.c
@@ -819,7 +819,7 @@ static int cx24116_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
819static void cx24116_clone_params(struct dvb_frontend *fe) 819static void cx24116_clone_params(struct dvb_frontend *fe)
820{ 820{
821 struct cx24116_state *state = fe->demodulator_priv; 821 struct cx24116_state *state = fe->demodulator_priv;
822 memcpy(&state->dcur, &state->dnxt, sizeof(state->dcur)); 822 state->dcur = state->dnxt;
823} 823}
824 824
825/* Wait for LNB */ 825/* Wait for LNB */
diff --git a/drivers/media/dvb-frontends/drxd_hard.c b/drivers/media/dvb-frontends/drxd_hard.c
index 487c53b69bf3..9a2134792cfa 100644
--- a/drivers/media/dvb-frontends/drxd_hard.c
+++ b/drivers/media/dvb-frontends/drxd_hard.c
@@ -2965,7 +2965,7 @@ struct dvb_frontend *drxd_attach(const struct drxd_config *config,
2965 return NULL; 2965 return NULL;
2966 memset(state, 0, sizeof(*state)); 2966 memset(state, 0, sizeof(*state));
2967 2967
2968 memcpy(&state->ops, &drxd_ops, sizeof(struct dvb_frontend_ops)); 2968 state->ops = drxd_ops;
2969 state->dev = dev; 2969 state->dev = dev;
2970 state->config = *config; 2970 state->config = *config;
2971 state->i2c = i2c; 2971 state->i2c = i2c;
@@ -2976,8 +2976,7 @@ struct dvb_frontend *drxd_attach(const struct drxd_config *config,
2976 if (Read16(state, 0, 0, 0) < 0) 2976 if (Read16(state, 0, 0, 0) < 0)
2977 goto error; 2977 goto error;
2978 2978
2979 memcpy(&state->frontend.ops, &drxd_ops, 2979 state->frontend.ops = drxd_ops;
2980 sizeof(struct dvb_frontend_ops));
2981 state->frontend.demodulator_priv = state; 2980 state->frontend.demodulator_priv = state;
2982 ConfigureMPEGOutput(state, 0); 2981 ConfigureMPEGOutput(state, 0);
2983 /* add few initialization to allow gate control */ 2982 /* add few initialization to allow gate control */
diff --git a/drivers/media/dvb-frontends/stv0299.c b/drivers/media/dvb-frontends/stv0299.c
index 92a6075cd82f..b57ecf42e75a 100644
--- a/drivers/media/dvb-frontends/stv0299.c
+++ b/drivers/media/dvb-frontends/stv0299.c
@@ -420,7 +420,7 @@ static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, unsigned long
420 420
421 do_gettimeofday (&nexttime); 421 do_gettimeofday (&nexttime);
422 if (debug_legacy_dish_switch) 422 if (debug_legacy_dish_switch)
423 memcpy (&tv[0], &nexttime, sizeof (struct timeval)); 423 tv[0] = nexttime;
424 stv0299_writeregI (state, 0x0c, reg0x0c | 0x50); /* set LNB to 18V */ 424 stv0299_writeregI (state, 0x0c, reg0x0c | 0x50); /* set LNB to 18V */
425 425
426 dvb_frontend_sleep_until(&nexttime, 32000); 426 dvb_frontend_sleep_until(&nexttime, 32000);