dib7000p_get_stats: âiâ is used uninitialized (was: Re: [media] dib7000p: Add DVBv5 stats support)

From: Geert Uytterhoeven
Date: Wed Aug 06 2014 - 15:31:10 EST


Hi Mauro,

On Wed, Aug 6, 2014 at 2:03 AM, Linux Kernel Mailing List
<linux-kernel@xxxxxxxxxxxxxxx> wrote:
> Gitweb: http://git.kernel.org/linus/;a=commit;h=041ad449683bb2d54a7f082d78ec15bbc958a175
> Commit: 041ad449683bb2d54a7f082d78ec15bbc958a175
> Parent: d44913c1e547df19b2dc0b527f92a4b4354be23a
> Refname: refs/heads/master
> Author: Mauro Carvalho Chehab <m.chehab@xxxxxxxxxxx>
> AuthorDate: Thu May 29 14:44:56 2014 -0300
> Committer: Mauro Carvalho Chehab <m.chehab@xxxxxxxxxxx>
> CommitDate: Tue Jun 17 12:04:50 2014 -0300
>
> [media] dib7000p: Add DVBv5 stats support
>
> Adds DVBv5 stats support. For now, just mimic whatever dib8000
> does, as they're very similar, with regards to statistics.
>
> However, dib7000p_get_time_us() likely require some
> adjustments, as I didn't actually reviewed the formula
> for it to work with DVB-T. Still, better than nothing,
> as latter patches can improve it.

Yes, it does, as its "layer" parameter is not used....

> diff --git a/drivers/media/dvb-frontends/dib7000p.c b/drivers/media/dvb-frontends/dib7000p.c
> index d36fa0d..c41f90d 100644
> --- a/drivers/media/dvb-frontends/dib7000p.c
> +++ b/drivers/media/dvb-frontends/dib7000p.c

> +/* FIXME: may require changes - this one was borrowed from dib8000 */
> +static u32 dib7000p_get_time_us(struct dvb_frontend *demod, int layer)
> +{

[...]

> +}

> +static int dib7000p_get_stats(struct dvb_frontend *demod, fe_status_t stat)
> +{
> + struct dib7000p_state *state = demod->demodulator_priv;
> + struct dtv_frontend_properties *c = &demod->dtv_property_cache;
> + int i;

[...]

> + /* Get PER measures */
> + if (show_per_stats) {
> + dib7000p_read_unc_blocks(demod, &val);
> +
> + c->block_error.stat[0].scale = FE_SCALE_COUNTER;
> + c->block_error.stat[0].uvalue += val;
> +
> + time_us = dib7000p_get_time_us(demod, i);

drivers/media/dvb-frontends/dib7000p.c: In function âdib7000p_get_statsâ:
drivers/media/dvb-frontends/dib7000p.c:1972: warning: âiâ is used
uninitialized in this function

So far this is harmless, as the "layer" parameter isn't used, but this
deserves some cleanup.

> + if (time_us) {
> + blocks = 1250000ULL * 1000000ULL;
> + do_div(blocks, time_us * 8 * 204);
> + c->block_count.stat[0].scale = FE_SCALE_COUNTER;
> + c->block_count.stat[0].uvalue += blocks;
> + }
> + }
> + return 0;
> +}

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/