Skip to contentSkip to conversation

drivers/media/dvb/frontends/tda10023.c: buggy (dead) code

DISCUSSION Adrian Bunk 1 participant 1 message Jun 15, 2007

lore
Share & tools
lore
#0 lore raw

The Coverity checker spotted the following buggy code in drivers/media/dvb/frontends/tda10023.c:

<-- snip -->

...

#define XTAL   28920000UL
#define PLL_M  8UL
#define PLL_P  4UL
#define PLL_N  1UL

#define SYSCLK (XTAL*PLL_M/(PLL_N*PLL_P)) // -> 57840000
...
static int tda10023_set_symbolrate (struct tda10023_state* state, u32 sr) {
...

        if (sr<870000)
                sr=870000;

        if (sr < (u32)(SYSCLK/98.40)) {
                NDEC=3;
                SFIL=1;
        } else if (sr<(u32)(SYSCLK/64.0)) {
                NDEC=3;
                SFIL=0;
        } else if (sr<(u32)(SYSCLK/49.2)) {
                NDEC=2;
                SFIL=1;
        } else if (sr<(u32)(SYSCLK/32.0)) {
                NDEC=2;
                SFIL=0;
        } else if (sr<(u32)(SYSCLK/24.6)) {
                NDEC=1;
                SFIL=1;
        } else if (sr<(u32)(SYSCLK/16.0)) {
                NDEC=1;
                SFIL=0;
        } else if (sr<(u32)(SYSCLK/12.3)) {
                NDEC=0;
                SFIL=1;
        }

...
}
...

<-- snip -->

57840000 / 98.40 = 587804 < 870000

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed