aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEzequiel Garcia <elezegarcia@gmail.com>2013-01-14 13:22:55 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-02-05 11:31:36 -0500
commit8c0d44e250735b09e255ce0483c47eb2f68d3fa7 (patch)
treef17c238670b5e56b3600c13517e0de4c853348b0
parent5d97046a371a44010bbfd18a75c2b107da30a606 (diff)
[media] uvcvideo: 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. Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/usb/uvc/uvc_ctrl.c2
-rw-r--r--drivers/media/usb/uvc/uvc_v4l2.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index d5baab17a5ef..61e28dec991d 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -1838,7 +1838,7 @@ static int uvc_ctrl_add_info(struct uvc_device *dev, struct uvc_control *ctrl,
1838{ 1838{
1839 int ret = 0; 1839 int ret = 0;
1840 1840
1841 memcpy(&ctrl->info, info, sizeof(*info)); 1841 ctrl->info = *info;
1842 INIT_LIST_HEAD(&ctrl->info.mappings); 1842 INIT_LIST_HEAD(&ctrl->info.mappings);
1843 1843
1844 /* Allocate an array to save control values (cur, def, max, etc.) */ 1844 /* Allocate an array to save control values (cur, def, max, etc.) */
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 68d59b527492..97a4ffde5d6f 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -315,7 +315,7 @@ static int uvc_v4l2_set_format(struct uvc_streaming *stream,
315 goto done; 315 goto done;
316 } 316 }
317 317
318 memcpy(&stream->ctrl, &probe, sizeof probe); 318 stream->ctrl = probe;
319 stream->cur_format = format; 319 stream->cur_format = format;
320 stream->cur_frame = frame; 320 stream->cur_frame = frame;
321 321
@@ -387,7 +387,7 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream,
387 return -EBUSY; 387 return -EBUSY;
388 } 388 }
389 389
390 memcpy(&probe, &stream->ctrl, sizeof probe); 390 probe = stream->ctrl;
391 probe.dwFrameInterval = 391 probe.dwFrameInterval =
392 uvc_try_frame_interval(stream->cur_frame, interval); 392 uvc_try_frame_interval(stream->cur_frame, interval);
393 393
@@ -398,7 +398,7 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream,
398 return ret; 398 return ret;
399 } 399 }
400 400
401 memcpy(&stream->ctrl, &probe, sizeof probe); 401 stream->ctrl = probe;
402 mutex_unlock(&stream->mutex); 402 mutex_unlock(&stream->mutex);
403 403
404 /* Return the actual frame period. */ 404 /* Return the actual frame period. */