Message ID | 1351022246-8201-1-git-send-email-elezegarcia@gmail.com (mailing list archive) |
---|---|
State | Changes Requested, archived |
Headers |
Received: from bouncing.tu-berlin.de ([130.149.7.34]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from <linux-media-owner@vger.kernel.org>) id 1TQkcS-000160-Nv for patchwork@linuxtv.org; Tue, 23 Oct 2012 21:58:32 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-4) with esmtp for <patchwork@linuxtv.org> id 1TQkcS-0000f5-A0; Tue, 23 Oct 2012 21:58:32 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756936Ab2JWT6P (ORCPT <rfc822;patchwork@linuxtv.org>); Tue, 23 Oct 2012 15:58:15 -0400 Received: from mail-yh0-f46.google.com ([209.85.213.46]:34920 "EHLO mail-yh0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756781Ab2JWT6O (ORCPT <rfc822;linux-media@vger.kernel.org>); Tue, 23 Oct 2012 15:58:14 -0400 Received: by mail-yh0-f46.google.com with SMTP id m54so823829yhm.19 for <multiple recipients>; Tue, 23 Oct 2012 12:58:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=IDTzaS9cKYcqaMf7Kta4+FHwhybypo2sgDtbRLJQ8w0=; b=EfeRj3gwkvmXIwN9bGekC988h3PJrmZoHqqeOsA1j6FVjwiM67yr9X5kknu82hEKsl uZNHY28qRAXSZtOi8NXU36onAYeYan3odCN090vVWWDmeGkKa+QIVLQ6FpNGHUc0qgMt xYNJoeJL4lHrbKPpHkV16SJ67rTuHyIWUNmOloAmXtFW6TNTAO34tdCT0i4QIy/GL/bZ SNyAWF3sCM3Ln+Zjg9/9a8nrUCURz64q2Rck1Zum//CXcpWejEQTCRHMS1FhcOmDv4fk EYO2M0sYnpFnvJ+isPrRP4LjlvnU6Vlaq9oYlC/dYizpin52b/+hyx8ksa8GyMRunRgY qa3A== Received: by 10.236.190.194 with SMTP id e42mr12671755yhn.28.1351022293863; Tue, 23 Oct 2012 12:58:13 -0700 (PDT) Received: from localhost.localdomain ([186.153.120.250]) by mx.google.com with ESMTPS id k63sm12813347yhj.20.2012.10.23.12.58.10 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 23 Oct 2012 12:58:12 -0700 (PDT) From: Ezequiel Garcia <elezegarcia@gmail.com> To: <linux-kernel@vger.kernel.org>, <linux-media@vger.kernel.org> Cc: Julia.Lawall@lip6.fr, kernel-janitors@vger.kernel.org, Ezequiel Garcia <elezegarcia@gmail.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Peter Senna Tschudin <peter.senna@gmail.com> Subject: [PATCH 01/23] uvc: Replace memcpy with struct assignment Date: Tue, 23 Oct 2012 16:57:04 -0300 Message-Id: <1351022246-8201-1-git-send-email-elezegarcia@gmail.com> X-Mailer: git-send-email 1.7.4.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.10.23.194815 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' FORGED_FROM_GMAIL 0.1, HTML_NO_HTTP 0.1, MULTIPLE_RCPTS 0.1, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1900_1999 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_FROM 0, __HAS_HTML 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' |
Commit Message
Ezequiel Garcia
Oct. 23, 2012, 7:57 p.m. UTC
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> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> --- drivers/media/usb/uvc/uvc_v4l2.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
Comments
Hi Ezequiel, Thanks for the patch. On Tuesday 23 October 2012 16:57:04 Ezequiel Garcia wrote: > 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. This looks good, but there's one more memcpy that can be replaced by a direct structure assignment in uvc_ctrl_add_info() (drivers/media/usb/uvc/uvc_ctrl.c). You might want to check why it hasn't been caught by the semantic patch. > 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> > > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> > Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> > --- > drivers/media/usb/uvc/uvc_v4l2.c | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/usb/uvc/uvc_v4l2.c > b/drivers/media/usb/uvc/uvc_v4l2.c index f00db30..4fc8737 100644 > --- a/drivers/media/usb/uvc/uvc_v4l2.c > +++ b/drivers/media/usb/uvc/uvc_v4l2.c > @@ -314,7 +314,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; > > @@ -386,7 +386,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); > > @@ -397,7 +397,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. */
Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote: >Hi Ezequiel, > >Thanks for the patch. > >On Tuesday 23 October 2012 16:57:04 Ezequiel Garcia wrote: >> 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. > >This looks good, but there's one more memcpy that can be replaced by a >direct >structure assignment in uvc_ctrl_add_info() >(drivers/media/usb/uvc/uvc_ctrl.c). You might want to check why it >hasn't been >caught by the semantic patch. > >> 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> >> >> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> >> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> >> Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> >> --- >> drivers/media/usb/uvc/uvc_v4l2.c | 6 +++--- >> 1 files changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c >> b/drivers/media/usb/uvc/uvc_v4l2.c index f00db30..4fc8737 100644 >> --- a/drivers/media/usb/uvc/uvc_v4l2.c >> +++ b/drivers/media/usb/uvc/uvc_v4l2.c >> @@ -314,7 +314,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; >> >> @@ -386,7 +386,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); >> >> @@ -397,7 +397,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. */ > >-- >Regards, > >Laurent Pinchart > >-- >To unsubscribe from this list: send the line "unsubscribe linux-media" >in >the body of a message to majordomo@vger.kernel.org >More majordomo info at http://vger.kernel.org/majordomo-info.html Maybe because there is no '&' operator on the second argument. Regards, Andy -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Mauro, On Tue, Oct 23, 2012 at 4:57 PM, Ezequiel Garcia <elezegarcia@gmail.com> wrote: > 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> > > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> > Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> > --- > drivers/media/usb/uvc/uvc_v4l2.c | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c > index f00db30..4fc8737 100644 > --- a/drivers/media/usb/uvc/uvc_v4l2.c > +++ b/drivers/media/usb/uvc/uvc_v4l2.c > @@ -314,7 +314,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; > > @@ -386,7 +386,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); > > @@ -397,7 +397,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. */ > -- > 1.7.4.4 > It seems you've marked this one as "Changes requested" [1]. However, Laurent didn't request any change, but just pointed out we missed one memcpy replacement candidate. I believe it's safe to apply the patch (together with the other 20 patches) and we can fix the missing spot in another patch. Thanks,
Em Thu, 27 Dec 2012 18:12:46 -0300 Ezequiel Garcia <elezegarcia@gmail.com> escreveu: > Mauro, > > On Tue, Oct 23, 2012 at 4:57 PM, Ezequiel Garcia <elezegarcia@gmail.com> wrote: > > 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> > > > > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> > > Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> > > --- > > drivers/media/usb/uvc/uvc_v4l2.c | 6 +++--- > > 1 files changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c > > index f00db30..4fc8737 100644 > > --- a/drivers/media/usb/uvc/uvc_v4l2.c > > +++ b/drivers/media/usb/uvc/uvc_v4l2.c > > @@ -314,7 +314,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; > > > > @@ -386,7 +386,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); > > > > @@ -397,7 +397,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. */ > > -- > > 1.7.4.4 > > > > It seems you've marked this one as "Changes requested" [1]. > However, Laurent didn't request any change, > but just pointed out we missed one memcpy replacement candidate. > > I believe it's safe to apply the patch (together with the other 20 patches) > and we can fix the missing spot in another patch. The other patches got applied already. Well just do whatever Laurent asked you and re-submit this one ;) Regards, Mauro -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Ezequiel, On Thursday 27 December 2012 21:49:37 Mauro Carvalho Chehab wrote: > Em Thu, 27 Dec 2012 18:12:46 -0300 Ezequiel Garcia escreveu: > > On Tue, Oct 23, 2012 at 4:57 PM, Ezequiel Garcia wrote: > > > 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> > > > > > > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > > Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> > > > Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> > > > --- > > > > > > drivers/media/usb/uvc/uvc_v4l2.c | 6 +++--- > > > 1 files changed, 3 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/media/usb/uvc/uvc_v4l2.c > > > b/drivers/media/usb/uvc/uvc_v4l2.c index f00db30..4fc8737 100644 > > > --- a/drivers/media/usb/uvc/uvc_v4l2.c > > > +++ b/drivers/media/usb/uvc/uvc_v4l2.c > > > @@ -314,7 +314,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; > > > @@ -386,7 +386,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); > > > > > > @@ -397,7 +397,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. */ > > > > It seems you've marked this one as "Changes requested" [1]. > > However, Laurent didn't request any change, > > but just pointed out we missed one memcpy replacement candidate. > > > > I believe it's safe to apply the patch (together with the other 20 > > patches) and we can fix the missing spot in another patch. > > The other patches got applied already. Well just do whatever Laurent asked > you and re-submit this one ;) Could you please resubmit this patch with the missed memcpy replaced by a struct assignment ? I'll then add it to my tree.
On Wed, Jan 9, 2013 at 9:19 PM, Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote: > Hi Ezequiel, > > On Thursday 27 December 2012 21:49:37 Mauro Carvalho Chehab wrote: >> Em Thu, 27 Dec 2012 18:12:46 -0300 Ezequiel Garcia escreveu: >> > On Tue, Oct 23, 2012 at 4:57 PM, Ezequiel Garcia wrote: >> > > 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> >> > > >> > > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> >> > > Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> >> > > Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> >> > > --- >> > > >> > > drivers/media/usb/uvc/uvc_v4l2.c | 6 +++--- >> > > 1 files changed, 3 insertions(+), 3 deletions(-) >> > > >> > > diff --git a/drivers/media/usb/uvc/uvc_v4l2.c >> > > b/drivers/media/usb/uvc/uvc_v4l2.c index f00db30..4fc8737 100644 >> > > --- a/drivers/media/usb/uvc/uvc_v4l2.c >> > > +++ b/drivers/media/usb/uvc/uvc_v4l2.c >> > > @@ -314,7 +314,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; >> > > @@ -386,7 +386,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); >> > > >> > > @@ -397,7 +397,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. */ >> > >> > It seems you've marked this one as "Changes requested" [1]. >> > However, Laurent didn't request any change, >> > but just pointed out we missed one memcpy replacement candidate. >> > >> > I believe it's safe to apply the patch (together with the other 20 >> > patches) and we can fix the missing spot in another patch. >> >> The other patches got applied already. Well just do whatever Laurent asked >> you and re-submit this one ;) > > Could you please resubmit this patch with the missed memcpy replaced by a > struct assignment ? I'll then add it to my tree. > Sure! Thanks,
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index f00db30..4fc8737 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -314,7 +314,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; @@ -386,7 +386,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); @@ -397,7 +397,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. */