mirror of
https://github.com/fail0verflow/switch-linux.git
synced 2025-11-04 18:17:40 -05:00
media: tw5864, fc0011: better handle WARN_ON()
As such macro will check if the expression is true, it may fall through, as
warned:
In file included from ./include/uapi/linux/stddef.h:1:0,
from ./include/linux/stddef.h:4,
from ./include/uapi/linux/posix_types.h:4,
from ./include/uapi/linux/types.h:13,
from ./include/linux/types.h:5,
from ./drivers/media/dvb-core/dvb_frontend.h:35,
from drivers/media/tuners/fc0011.h:4,
from drivers/media/tuners/fc0011.c:20:
drivers/media/tuners/fc0011.c: In function 'fc0011_set_params':
./include/linux/compiler.h:179:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
# define unlikely(x) __builtin_expect(!!(x), 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/bug.h:109:2: note: in expansion of macro 'unlikely'
unlikely(__ret_warn_on); \
^~~~~~~~
drivers/media/tuners/fc0011.c:344:3: note: in expansion of macro 'WARN_ON'
WARN_ON(1);
^~~~~~~
drivers/media/tuners/fc0011.c:345:2: note: here
case 0:
^~~~
In file included from ./include/uapi/linux/stddef.h:1:0,
from ./include/linux/stddef.h:4,
from ./include/uapi/linux/posix_types.h:4,
from ./include/uapi/linux/types.h:13,
from ./include/linux/types.h:5,
from ./include/linux/list.h:4,
from ./include/linux/module.h:9,
from drivers/media/pci/tw5864/tw5864-video.c:17:
drivers/media/pci/tw5864/tw5864-video.c: In function 'tw5864_fmt_vid_cap':
./include/linux/compiler.h:179:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
# define unlikely(x) __builtin_expect(!!(x), 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/bug.h:68:2: note: in expansion of macro 'unlikely'
unlikely(__ret_warn_on); \
^~~~~~~~
drivers/media/pci/tw5864/tw5864-video.c:547:3: note: in expansion of macro 'WARN_ON_ONCE'
WARN_ON_ONCE(1);
^~~~~~~~~~~~
drivers/media/pci/tw5864/tw5864-video.c:548:2: note: here
case STD_NTSC:
^~~~
On both cases, it means an error, so, let's return an error
code, to make gcc happy.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Michael Büsch <m@bues.ch>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
e1d00cddfb
commit
f7d84fa704
2 changed files with 2 additions and 0 deletions
drivers/media
|
|
@ -545,6 +545,7 @@ static int tw5864_fmt_vid_cap(struct file *file, void *priv,
|
||||||
switch (input->std) {
|
switch (input->std) {
|
||||||
default:
|
default:
|
||||||
WARN_ON_ONCE(1);
|
WARN_ON_ONCE(1);
|
||||||
|
return -EINVAL;
|
||||||
case STD_NTSC:
|
case STD_NTSC:
|
||||||
f->fmt.pix.height = 480;
|
f->fmt.pix.height = 480;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -342,6 +342,7 @@ static int fc0011_set_params(struct dvb_frontend *fe)
|
||||||
switch (vco_sel) {
|
switch (vco_sel) {
|
||||||
default:
|
default:
|
||||||
WARN_ON(1);
|
WARN_ON(1);
|
||||||
|
return -EINVAL;
|
||||||
case 0:
|
case 0:
|
||||||
if (vco_cal < 8) {
|
if (vco_cal < 8) {
|
||||||
regs[FC11_REG_VCOSEL] &= ~(FC11_VCOSEL_1 | FC11_VCOSEL_2);
|
regs[FC11_REG_VCOSEL] &= ~(FC11_VCOSEL_1 | FC11_VCOSEL_2);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue