]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] v4l2-ioctl: fix W=1 warnings
authorHans Verkuil <hans.verkuil@cisco.com>
Tue, 2 Oct 2012 05:47:59 +0000 (02:47 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 7 Oct 2012 13:19:50 +0000 (10:19 -0300)
Since the prt_names() macro is always called with an unsigned index the
((a) >= 0) condition is always true and gives a compiler warning when
compiling with W=1.
Rewrite the macro to avoid that warning, but cast the index to unsigned
just in case it is ever called with a signed argument.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/v4l2-core/v4l2-ioctl.c

index 11874c170cbe41be9234b02811df098ca4a0c22a..8f388ff31ebb8732fd1793778c578f9395df777a 100644 (file)
@@ -157,8 +157,7 @@ static const char *v4l2_memory_names[] = {
        [V4L2_MEMORY_OVERLAY] = "overlay",
 };
 
-#define prt_names(a, arr) ((((a) >= 0) && ((a) < ARRAY_SIZE(arr))) ? \
-                          arr[a] : "unknown")
+#define prt_names(a, arr) (((unsigned)(a)) < ARRAY_SIZE(arr) ? arr[a] : "unknown")
 
 /* ------------------------------------------------------------------ */
 /* debug help functions                                               */