public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* drivers/media/dvb/frontends/tda10023.c: buggy (dead) code
@ 2007-06-15 20:40 Adrian Bunk
  0 siblings, 0 replies; only message in thread
From: Adrian Bunk @ 2007-06-15 20:40 UTC (permalink / raw)
  To: Hartmut Birr, Georg Acher, Oliver Endriss, Mauro Carvalho Chehab
  Cc: linux-kernel, v4l-dvb-maintainer

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

-- 

       "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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-06-15 20:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-15 20:40 drivers/media/dvb/frontends/tda10023.c: buggy (dead) code Adrian Bunk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox