public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] [media] dib8000: move dereference after check for NULL
@ 2012-07-20 11:11 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2012-07-20 11:11 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Patrick Boettcher, Olivier Grenie, linux-media, kernel-janitors

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>

diff --git a/drivers/media/dvb/frontends/dib8000.c b/drivers/media/dvb/frontends/dib8000.c
index 9ca34f4..1f3bcb5 100644
--- a/drivers/media/dvb/frontends/dib8000.c
+++ b/drivers/media/dvb/frontends/dib8000.c
@@ -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);
 

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

only message in thread, other threads:[~2012-07-20 11:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-20 11:11 [patch] [media] dib8000: move dereference after check for NULL Dan Carpenter

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