public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@stusta.de>
To: Hartmut Birr <e9hack@googlemail.com>,
	Georg Acher <acher@in.tum.de>, Oliver Endriss <o.endriss@gmx.de>,
	Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: linux-kernel@vger.kernel.org, v4l-dvb-maintainer@linuxtv.org
Subject: drivers/media/dvb/frontends/tda10023.c: buggy (dead) code
Date: Fri, 15 Jun 2007 22:40:47 +0200	[thread overview]
Message-ID: <20070615204047.GI3588@stusta.de> (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

-- 

       "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


                 reply	other threads:[~2007-06-15 20:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070615204047.GI3588@stusta.de \
    --to=bunk@stusta.de \
    --cc=acher@in.tum.de \
    --cc=e9hack@googlemail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=o.endriss@gmx.de \
    --cc=v4l-dvb-maintainer@linuxtv.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox