diff mbox

[OPW,kernel,04/10] staging: media: davinci_vpfe: Replace memcpy with struct assignment

Message ID 61688203809ec9f47b8a28a4e3ee16783fc35ce8.1412524266.git.tapaswenipathak@gmail.com
State New, archived
Headers show

Commit Message

Tapasweni Pathak Oct. 5, 2014, 4:03 p.m. UTC
This patch replaces this kind of memcpy() uses as it is
error prone. It is replaced with a struct assignment as it is
typesafe and much easier to read.

This is done by Coccinelle. Coccinelle script used:
// <smpl>
@@
identifier struct_name;
struct struct_name to;
struct struct_name from;
expression E;
@@
-memcpy(&(to), &(from), E);
+to = from;
// </smpl>

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
---
 drivers/staging/media/davinci_vpfe/dm365_ipipeif.c |    3 +--
 drivers/staging/media/davinci_vpfe/dm365_isif.c    |    3 +--
 drivers/staging/media/davinci_vpfe/dm365_resizer.c |    3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

--
1.7.9.5
diff mbox

Patch

diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
index 6d4893b..00eb8c0 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
@@ -748,8 +748,7 @@  static void ipipeif_set_default_config(struct vpfe_ipipeif_device *ipipeif)
 		},
 	};
 	memset(&ipipeif->config, 0, sizeof(struct ipipeif_params));
-	memcpy(&ipipeif->config, &ipipeif_defaults,
-	       sizeof(struct ipipeif_params));
+	ipipeif->config = ipipeif_defaults;
 }

 /*
diff --git a/drivers/staging/media/davinci_vpfe/dm365_isif.c b/drivers/staging/media/davinci_vpfe/dm365_isif.c
index 0d535b0..e033c34 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_isif.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_isif.c
@@ -609,8 +609,7 @@  static int isif_set_params(struct v4l2_subdev *sd, void *params)

 	memcpy(&isif_raw_params, params, sizeof(isif_raw_params));
 	if (!isif_validate_raw_params(&isif_raw_params)) {
-		memcpy(&isif->isif_cfg.bayer.config_params, &isif_raw_params,
-			sizeof(isif_raw_params));
+		isif->isif_cfg.bayer.config_params = isif_raw_params;
 		ret = 0;
 	}
 	return ret;
diff --git a/drivers/staging/media/davinci_vpfe/dm365_resizer.c b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
index 8828d6c..7da678e 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_resizer.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
@@ -908,8 +908,7 @@  resizer_set_defualt_configuration(struct vpfe_resizer_device *resizer)
 		},
 	};
 	memset(&resizer->config, 0, sizeof(struct resizer_params));
-	memcpy(&resizer->config, &rsz_default_config,
-	       sizeof(struct resizer_params));
+	resizer->config = rsz_default_config;
 }

 /*