提交 d9246240 编写于 作者: H Hans Verkuil 提交者: Mauro Carvalho Chehab

[media] v4l2-ioctl: fix W=1 warnings

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: NHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 1b8b10cc
......@@ -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 */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册