drivers/media/video/tvp5150.c:tvp5150_selmux() looks wrong

From: Adrian Bunk
Date: Mon Aug 14 2006 - 19:30:36 EST

The Coverity checker spotted this very strange code introduced by commit

<-- snip -->

static inline void tvp5150_selmux(struct i2c_client *c)
int opmode=0;
struct tvp5150 *decoder = i2c_get_clientdata(c);
int input = 0;

if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable)
input = 8;

switch (input) {
case TVP5150_COMPOSITE1:
input |= 2;
/* fall through */
case TVP5150_COMPOSITE0:
opmode=0x30; /* TV Mode */
case TVP5150_SVIDEO:
input |= 1;
opmode=0; /* Auto Mode */

tvp5150_write(c, TVP5150_OP_MODE_CTL, opmode);
tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input);

<-- snip -->

What is done with "input" looks really buggy (e.g. it's either 0 or 8
and the switch checks for 0, 1, 2).



Gentoo kernels are 42 times more popular than SUSE kernels among
KLive users (a service by SUSE contractor Andrea Arcangeli that
gathers data about kernels from many users worldwide).

There are three kinds of lies: Lies, Damn Lies, and Statistics.
Benjamin Disraeli

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at