Commit 27430d19 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Mauro Carvalho Chehab

[media] tw5864: use dev_warn instead of WARN to shut up warning

tw5864_frameinterval_get() only initializes its output when it successfully
identifies the video standard in tw5864_input. We get a warning here because
gcc can't always track the state if initialized warnings across a WARN()
macro, and thinks it might get used incorrectly in tw5864_s_parm:

media/pci/tw5864/tw5864-video.c: In function 'tw5864_s_parm':
media/pci/tw5864/tw5864-video.c:816:38: error: 'time_base.numerator' may be used uninitialized in this function [-Werror=maybe-uninitialized]
media/pci/tw5864/tw5864-video.c:819:31: error: 'time_base.denominator' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Using dev_warn() instead of WARN() avoids the __branch_check__() in
unlikely and lets the compiler see that the initialization is correct.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarAndrey Utkin <andrey.utkin@corp.bluecherry.net>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent c3d173a3
...@@ -716,6 +716,8 @@ static void tw5864_frame_interval_set(struct tw5864_input *input) ...@@ -716,6 +716,8 @@ static void tw5864_frame_interval_set(struct tw5864_input *input)
static int tw5864_frameinterval_get(struct tw5864_input *input, static int tw5864_frameinterval_get(struct tw5864_input *input,
struct v4l2_fract *frameinterval) struct v4l2_fract *frameinterval)
{ {
struct tw5864_dev *dev = input->root;
switch (input->std) { switch (input->std) {
case STD_NTSC: case STD_NTSC:
frameinterval->numerator = 1001; frameinterval->numerator = 1001;
...@@ -727,7 +729,7 @@ static int tw5864_frameinterval_get(struct tw5864_input *input, ...@@ -727,7 +729,7 @@ static int tw5864_frameinterval_get(struct tw5864_input *input,
frameinterval->denominator = 25; frameinterval->denominator = 25;
break; break;
default: default:
WARN(1, "tw5864_frameinterval_get requested for unknown std %d\n", dev_warn(&dev->pci->dev, "tw5864_frameinterval_get requested for unknown std %d\n",
input->std); input->std);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment