lkml.org 
[lkml]   [2008]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Video/UVC: Fix unaligned exceptions in uvc video driver.
On Sun, Nov 9, 2008 at 8:55 PM, Laurent Pinchart
<laurent.pinchart@skynet.be> wrote:
> Hi Bryan, Michael,
>
> Thanks for the patch.
>
> On Thursday 06 November 2008, Bryan Wu wrote:
>> From: Michael Hennerich <michael.hennerich@analog.com>
>>
>> buffer can be odd aligned on some NOMMU machine such as Blackfin
>
> The comment is a bit misleading. Buffers can be odd-aligned independently off
> the machine type. The issue comes from machines that can't access unaligned
> memory. Something like "Fix access to unaligned memory" would be better.
>
>> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
>> Signed-off-by: Bryan Wu <cooloney@kernel.org>
>> ---
>> drivers/media/video/uvc/uvc_driver.c | 37
>> +++++++++++++++++---------------- 1 files changed, 19 insertions(+), 18
>> deletions(-)
>>
>> diff --git a/drivers/media/video/uvc/uvc_driver.c
>> b/drivers/media/video/uvc/uvc_driver.c index d7ad060..9b4f469 100644
>> --- a/drivers/media/video/uvc/uvc_driver.c
>> +++ b/drivers/media/video/uvc/uvc_driver.c
>> @@ -31,6 +31,7 @@
>> #include <linux/videodev2.h>
>> #include <linux/vmalloc.h>
>> #include <linux/wait.h>
>> +#include <asm/unaligned.h>
>> #include <asm/atomic.h>
>>
>> #include <media/v4l2-common.h>
>> @@ -432,20 +433,20 @@ static int uvc_parse_format(struct uvc_device *dev,
>>
>> frame->bFrameIndex = buffer[3];
>> frame->bmCapabilities = buffer[4];
>> - frame->wWidth = le16_to_cpup((__le16 *)&buffer[5]);
>> - frame->wHeight = le16_to_cpup((__le16 *)&buffer[7]);
>> - frame->dwMinBitRate = le32_to_cpup((__le32 *)&buffer[9]);
>> - frame->dwMaxBitRate = le32_to_cpup((__le32 *)&buffer[13]);
>> + frame->wWidth = le16_to_cpu(get_unaligned((__le16 *) &buffer[5]));
>
> What about using get_unaligned_le16 and get_unaligned_le32 directly ? Lines
> would be shorter and could be kept behind the 80 columns limit more easily.
>
> Tell me if you want to resubmit or if I should make the modification myself
> (including the patch description).
>

I guess Michael will update this patch according to you review. Then
we will resubmit it.

Thanks a lot
-Bryan


\
 
 \ /
  Last update: 2008-11-10 03:11    [W:0.057 / U:2.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site