Skip to contentSkip to conversation

Warning in cx24110: how to fix?

DISCUSSION Hans Verkuil 2 participants 4 messages May 22, 2012 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

I'm getting this warning in the daily build:

v4l-dvb-git/drivers/media/dvb/frontends/cx24110.c: In function ‘cx24110_read_ucblocks’:
v4l-dvb-git/drivers/media/dvb/frontends/cx24110.c:520:40: warning: value computed is not used [-Wunused-value]

It comes from this code:

static int cx24110_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)

{
        struct cx24110_state *state = fe->demodulator_priv;

        if(cx24110_readreg(state,0x10)&0x40) {
                /* the RS error counter has finished one counting window */
                cx24110_writereg(state,0x10,0x60); /* select the byer reg */
                cx24110_readreg(state, 0x12) |
                        (cx24110_readreg(state, 0x13) << 8) |
                        (cx24110_readreg(state, 0x14) << 16);
                cx24110_writereg(state,0x10,0x70); /* select the bler reg */
                state->lastbler=cx24110_readreg(state,0x12)|
                        (cx24110_readreg(state,0x13)<<8)|
                        (cx24110_readreg(state,0x14)<<16);
                cx24110_writereg(state,0x10,0x20); /* start new count window */
        }
        *ucblocks = state->lastbler;

        return 0;
}

This is the offending code:

                cx24110_readreg(state, 0x12) |
                        (cx24110_readreg(state, 0x13) << 8) |
                        (cx24110_readreg(state, 0x14) << 16);

Is there a reason these registers are read without storing their value? Or is it a bug?

Regards,

Hans

#1 lore raw

Hans Verkuil <[email protected]> wrote

Quoted 40 lines

I'm getting this warning in the daily build:

v4l-dvb-git/drivers/media/dvb/frontends/cx24110.c: In function ‘cx24110_read_ucblocks’:
v4l-dvb-git/drivers/media/dvb/frontends/cx24110.c:520:40: warning:
value computed is not used [-Wunused-value]

It comes from this code:

static int cx24110_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)

{
       struct cx24110_state *state = fe->demodulator_priv;

       if(cx24110_readreg(state,0x10)&0x40) {
           /* the RS error counter has finished one counting window */
          cx24110_writereg(state,0x10,0x60); /* select the byer reg */
               cx24110_readreg(state, 0x12) |
                       (cx24110_readreg(state, 0x13) << 8) |
                       (cx24110_readreg(state, 0x14) << 16);
          cx24110_writereg(state,0x10,0x70); /* select the bler reg */
               state->lastbler=cx24110_readreg(state,0x12)|
                       (cx24110_readreg(state,0x13)<<8)|
                       (cx24110_readreg(state,0x14)<<16);
       cx24110_writereg(state,0x10,0x20); /* start new count window */
       }
       *ucblocks = state->lastbler;

       return 0;
}

This is the offending code:

               cx24110_readreg(state, 0x12) |
                       (cx24110_readreg(state, 0x13) << 8) |
                       (cx24110_readreg(state, 0x14) << 16);

Is there a reason these registers are read without storing their value? Or is it a bug?

Quoted 8 lines

Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

I would guess the safest thing to do is still perform the registers reads.

Will adding a "(void)" cast to the beginning of the statement work?

Regards,
Andy

#2 lore raw
Quoted 51 lines · On Tue 22 May 2012 13:06:25 Andy Walls wrote:

Hans Verkuil <[email protected]> wrote

Quoted 40 lines

I'm getting this warning in the daily build:

v4l-dvb-git/drivers/media/dvb/frontends/cx24110.c: In function ‘cx24110_read_ucblocks’:
v4l-dvb-git/drivers/media/dvb/frontends/cx24110.c:520:40: warning:
value computed is not used [-Wunused-value]

It comes from this code:

static int cx24110_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)

{
       struct cx24110_state *state = fe->demodulator_priv;

       if(cx24110_readreg(state,0x10)&0x40) {
           /* the RS error counter has finished one counting window */
          cx24110_writereg(state,0x10,0x60); /* select the byer reg */
               cx24110_readreg(state, 0x12) |
                       (cx24110_readreg(state, 0x13) << 8) |
                       (cx24110_readreg(state, 0x14) << 16);
          cx24110_writereg(state,0x10,0x70); /* select the bler reg */
               state->lastbler=cx24110_readreg(state,0x12)|
                       (cx24110_readreg(state,0x13)<<8)|
                       (cx24110_readreg(state,0x14)<<16);
       cx24110_writereg(state,0x10,0x20); /* start new count window */
       }
       *ucblocks = state->lastbler;

       return 0;
}

This is the offending code:

               cx24110_readreg(state, 0x12) |
                       (cx24110_readreg(state, 0x13) << 8) |
                       (cx24110_readreg(state, 0x14) << 16);

Is there a reason these registers are read without storing their value? Or is it a bug?

Quoted 8 lines

Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 3 lines

I would guess the safest thing to do is still perform the registers reads.

Will adding a "(void)" cast to the beginning of the statement work?

Sure, that will work. But I just wonder if anyone actually knows *why* this is done in this way. It would be nice to have a comment here describing the reason (if there is one, of course).

Regards,

Hans

#3 lore raw
Quoted 69 lines · Hans Verkuil
Quoted 18 lines · On Tue 22 May 2012 13:06:25 Andy Walls wrote:

Hans Verkuil <[email protected]> wrote

Quoted 16 lines

I'm getting this warning in the daily build:

v4l-dvb-git/drivers/media/dvb/frontends/cx24110.c: In function ‘cx24110_read_ucblocks’:
v4l-dvb-git/drivers/media/dvb/frontends/cx24110.c:520:40: warning:
value computed is not used [-Wunused-value]

It comes from this code:

static int cx24110_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)

{
       struct cx24110_state *state = fe->demodulator_priv;

       if(cx24110_readreg(state,0x10)&0x40) {
           /* the RS error counter has finished one counting window

*/

Quoted 1 line
Quoted 1 line
          cx24110_writereg(state,0x10,0x60); /* select the byer reg

*/

Quoted 4 lines
Quoted 4 lines
               cx24110_readreg(state, 0x12) |
                       (cx24110_readreg(state, 0x13) << 8) |
                       (cx24110_readreg(state, 0x14) << 16);
          cx24110_writereg(state,0x10,0x70); /* select the bler reg

*/

Quoted 4 lines
Quoted 4 lines
               state->lastbler=cx24110_readreg(state,0x12)|
                       (cx24110_readreg(state,0x13)<<8)|
                       (cx24110_readreg(state,0x14)<<16);
       cx24110_writereg(state,0x10,0x20); /* start new count window

*/

Quoted 6 lines
Quoted 6 lines
       }
       *ucblocks = state->lastbler;

       return 0;
}
Quoted 7 lines
Quoted 7 lines

This is the offending code:

               cx24110_readreg(state, 0x12) |
                       (cx24110_readreg(state, 0x13) << 8) |
                       (cx24110_readreg(state, 0x14) << 16);

Is there a reason these registers are read without storing their

value?

Quoted 7 lines
Quoted 7 lines

Or is it a bug?

Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe

linux-media"

Quoted 5 lines
Quoted 3 lines

in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

I would guess the safest thing to do is still perform the registers

reads.

Quoted 2 lines

Will adding a "(void)" cast to the beginning of the statement work?

Sure, that will work. But I just wonder if anyone actually knows *why* this
is done in this way. It would be nice to have a comment here describing the
reason (if there is one, of course).

Quoted 3 lines

Regards,

Hans

I wouldn't agonize over it.

Assume the reads have the side effect of reseting the "byer" (byte error rate?) counter before it rolls over.

The likely case is that nothing bad will happpen if you don't read that register. A worse case is that by not reading that register, the other measurment/count registers won't read properly.

Regards,
Andy