]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] uvcvideo: Replace memcpy with struct assignment
authorEzequiel Garcia <elezegarcia@gmail.com>
Mon, 14 Jan 2013 18:22:55 +0000 (15:22 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 5 Feb 2013 16:31:36 +0000 (14:31 -0200)
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>
drivers/media/usb/uvc/uvc_ctrl.c
drivers/media/usb/uvc/uvc_v4l2.c

index d5baab17a5ef77b6bbeb85f8cf3e2c1b0127b5b7..61e28dec991d1c7375c0e9749ad639deaf8761f8 100644 (file)
@@ -1838,7 +1838,7 @@ static int uvc_ctrl_add_info(struct uvc_device *dev, struct uvc_control *ctrl,
 {
        int ret = 0;
 
-       memcpy(&ctrl->info, info, sizeof(*info));
+       ctrl->info = *info;
        INIT_LIST_HEAD(&ctrl->info.mappings);
 
        /* Allocate an array to save control values (cur, def, max, etc.) */
index 68d59b52749288e00dcb816f42952516f160f6db..97a4ffde5d6f094ec68c8a86898e2b7d3a909687 100644 (file)
@@ -315,7 +315,7 @@ static int uvc_v4l2_set_format(struct uvc_streaming *stream,
                goto done;
        }
 
-       memcpy(&stream->ctrl, &probe, sizeof probe);
+       stream->ctrl = probe;
        stream->cur_format = format;
        stream->cur_frame = frame;
 
@@ -387,7 +387,7 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream,
                return -EBUSY;
        }
 
-       memcpy(&probe, &stream->ctrl, sizeof probe);
+       probe = stream->ctrl;
        probe.dwFrameInterval =
                uvc_try_frame_interval(stream->cur_frame, interval);
 
@@ -398,7 +398,7 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream,
                return ret;
        }
 
-       memcpy(&stream->ctrl, &probe, sizeof probe);
+       stream->ctrl = probe;
        mutex_unlock(&stream->mutex);
 
        /* Return the actual frame period. */