Skip to content

Commit

Permalink
[media] dib8000: move dereference after check for NULL
Browse files Browse the repository at this point in the history
My static checker complains that we dereference "state" inside the call
to fft_to_mode() before checking for NULL.  The comments say that it is
possible for "state" to be NULL so I have moved the dereference after
the check.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Dan Carpenter authored and Mauro Carvalho Chehab committed Jul 31, 2012
1 parent d1b4a08 commit e04f4b2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/media/dvb/frontends/dib8000.c
Original file line number Diff line number Diff line change
Expand Up @@ -2680,12 +2680,14 @@ static int dib8000_tune(struct dvb_frontend *fe)
{
struct dib8000_state *state = fe->demodulator_priv;
int ret = 0;
u16 lock, value, mode = fft_to_mode(state);
u16 lock, value, mode;

// we are already tuned - just resuming from suspend
if (state == NULL)
return -EINVAL;

mode = fft_to_mode(state);

dib8000_set_bandwidth(fe, state->fe[0]->dtv_property_cache.bandwidth_hz / 1000);
dib8000_set_channel(state, 0, 0);

Expand Down

0 comments on commit e04f4b2

Please sign in to comment.