public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Pascal Terjan <pterjan@mandriva.com>
To: linux-media@vger.kernel.org
Subject: [PATCH] [budget] Wrong code on init failure
Date: Wed, 12 May 2010 16:40:40 +0200	[thread overview]
Message-ID: <1273675240.20854.68.camel@plop> (raw)

In frontend_init you can read:

    if (budget->dvb_frontend) {
        ctl = dvb_attach(stv6110x_attach,
                         budget->dvb_frontend,
                         &tt1600_stv6110x_config,
                         &budget->i2c_adap);
        tt1600_stv090x_config.tuner_init          = ctl->tuner_init;

[...]

    } else {
        dvb_frontend_detach(budget->dvb_frontend);
        budget->dvb_frontend = NULL;
    }

But if we are in else, budget->dvb_frontend is already NULL...

I guess the else part could better apply to a test on ctl before using
it
---
 drivers/media/dvb/ttpci/budget.c |   39 +++++++++++++++++++------------------
 1 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
index 9fdf26c..14adf27 100644
--- a/drivers/media/dvb/ttpci/budget.c
+++ b/drivers/media/dvb/ttpci/budget.c
@@ -627,25 +627,26 @@ static void frontend_init(struct budget *budget)
 						 &tt1600_stv6110x_config,
 						 &budget->i2c_adap);
 
-				tt1600_stv090x_config.tuner_init	  = ctl->tuner_init;
-				tt1600_stv090x_config.tuner_set_mode	  = ctl->tuner_set_mode;
-				tt1600_stv090x_config.tuner_set_frequency = ctl->tuner_set_frequency;
-				tt1600_stv090x_config.tuner_get_frequency = ctl->tuner_get_frequency;
-				tt1600_stv090x_config.tuner_set_bandwidth = ctl->tuner_set_bandwidth;
-				tt1600_stv090x_config.tuner_get_bandwidth = ctl->tuner_get_bandwidth;
-				tt1600_stv090x_config.tuner_set_bbgain	  = ctl->tuner_set_bbgain;
-				tt1600_stv090x_config.tuner_get_bbgain	  = ctl->tuner_get_bbgain;
-				tt1600_stv090x_config.tuner_set_refclk	  = ctl->tuner_set_refclk;
-				tt1600_stv090x_config.tuner_get_status	  = ctl->tuner_get_status;
-
-				dvb_attach(isl6423_attach,
-					budget->dvb_frontend,
-					&budget->i2c_adap,
-					&tt1600_isl6423_config);
-
-			} else {
-				dvb_frontend_detach(budget->dvb_frontend);
-				budget->dvb_frontend = NULL;
+				if (ctl) {
+					tt1600_stv090x_config.tuner_init	  = ctl->tuner_init;
+					tt1600_stv090x_config.tuner_set_mode	  = ctl->tuner_set_mode;
+					tt1600_stv090x_config.tuner_set_frequency = ctl->tuner_set_frequency;
+					tt1600_stv090x_config.tuner_get_frequency = ctl->tuner_get_frequency;
+					tt1600_stv090x_config.tuner_set_bandwidth = ctl->tuner_set_bandwidth;
+					tt1600_stv090x_config.tuner_get_bandwidth = ctl->tuner_get_bandwidth;
+					tt1600_stv090x_config.tuner_set_bbgain	  = ctl->tuner_set_bbgain;
+					tt1600_stv090x_config.tuner_get_bbgain	  = ctl->tuner_get_bbgain;
+					tt1600_stv090x_config.tuner_set_refclk	  = ctl->tuner_set_refclk;
+					tt1600_stv090x_config.tuner_get_status	  = ctl->tuner_get_status;
+
+					dvb_attach(isl6423_attach,
+						budget->dvb_frontend,
+						&budget->i2c_adap,
+						&tt1600_isl6423_config);
+				} else {
+					dvb_frontend_detach(budget->dvb_frontend);
+					budget->dvb_frontend = NULL;
+				}
 			}
 		}
 		break;
-- 
1.7.1



             reply	other threads:[~2010-05-12 14:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-12 14:40 Pascal Terjan [this message]
2010-05-12 14:48 ` [PATCH] [budget] Wrong code on init failure Pascal Terjan

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=1273675240.20854.68.camel@plop \
    --to=pterjan@mandriva.com \
    --cc=linux-media@vger.kernel.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