video:gspca.c Fix warning: case value '7' not in enumerated type 'enum v4l2_memory'

Message ID 20100708084010.6a15f8c3@tele (mailing list archive)
State Superseded, archived
Headers

Commit Message

Jean-Francois Moine July 8, 2010, 6:40 a.m. UTC
  On Wed,  7 Jul 2010 21:46:18 -0700
"Justin P. Mattock" <justinmattock@gmail.com> wrote:

> This fixes a warning I'm seeing when building:
>   CC [M]  drivers/media/video/gspca/gspca.o
> drivers/media/video/gspca/gspca.c: In function 'vidioc_reqbufs':
> drivers/media/video/gspca/gspca.c:1508:2: warning: case value '7' not
> in enumerated type 'enum v4l2_memory'

Hi Justin,

I don't agree with your patch: the value GSPCA_MEMORY_READ must not be
seen by user applications.

The warning may be simply fixed by (change the line numbers):


Cheers.
  

Comments

Justin P. Mattock July 8, 2010, 7:21 a.m. UTC | #1
On 07/07/2010 11:40 PM, Jean-Francois Moine wrote:
> On Wed,  7 Jul 2010 21:46:18 -0700
> "Justin P. Mattock"<justinmattock@gmail.com>  wrote:
>
>> This fixes a warning I'm seeing when building:
>>    CC [M]  drivers/media/video/gspca/gspca.o
>> drivers/media/video/gspca/gspca.c: In function 'vidioc_reqbufs':
>> drivers/media/video/gspca/gspca.c:1508:2: warning: case value '7' not
>> in enumerated type 'enum v4l2_memory'
>
> Hi Justin,
>
> I don't agree with your patch: the value GSPCA_MEMORY_READ must not be
> seen by user applications.
>
> The warning may be simply fixed by (change the line numbers):
>
> --- gspca.c~	2010-07-08 08:15:14.000000000 +0200
> +++ gspca.c	2010-07-08 08:28:52.000000000 +0200
> @@ -1467,7 +1467,8 @@ static int vidioc_reqbufs(struct file *f
>   	struct gspca_dev *gspca_dev = priv;
>   	int i, ret = 0, streaming;
>
> -	switch (rb->memory) {
> +	i = rb->memory;			/* (avoid compilation warning) */
> +	switch (i) {
>   	case GSPCA_MEMORY_READ:			/* (internal call) */
>   	case V4L2_MEMORY_MMAP:
>   	case V4L2_MEMORY_USERPTR:
>
> Cheers.
>


o.k. buddy.. make sense with the userspace etc..
Anyways looks good, builds without a warning..

Tested-By: Justin P. Mattock <justinmattock@gmail.com>

cheers as well,

Justin P. Mattock
--
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
  

Patch

--- gspca.c~	2010-07-08 08:15:14.000000000 +0200
+++ gspca.c	2010-07-08 08:28:52.000000000 +0200
@@ -1467,7 +1467,8 @@  static int vidioc_reqbufs(struct file *f
 	struct gspca_dev *gspca_dev = priv;
 	int i, ret = 0, streaming;
 
-	switch (rb->memory) {
+	i = rb->memory;			/* (avoid compilation warning) */
+	switch (i) {
 	case GSPCA_MEMORY_READ:			/* (internal call) */
 	case V4L2_MEMORY_MMAP:
 	case V4L2_MEMORY_USERPTR: