From patchwork Mon Jan 10 09:36:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Endriss X-Patchwork-Id: 468081 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0A9dEVS031125 for ; Mon, 10 Jan 2011 09:39:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753168Ab1AJJjN (ORCPT ); Mon, 10 Jan 2011 04:39:13 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:54058 "HELO mail.gmx.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with SMTP id S1752994Ab1AJJjL (ORCPT ); Mon, 10 Jan 2011 04:39:11 -0500 Received: (qmail invoked by alias); 10 Jan 2011 09:39:10 -0000 Received: from p5B30AF64.dip.t-dialin.net (HELO charon.escape-edv.de) [91.48.175.100] by mail.gmx.net (mp068) with SMTP; 10 Jan 2011 10:39:10 +0100 X-Authenticated: #476490 X-Provags-ID: V01U2FsdGVkX1+RJUArNWWRDacEEgoyrFGOJAiNWgCiQmSQCkzzsV 5FSskL7RJf//Bu Received: from orion.escape-edv.de (192.168.1.10) by charon.escape-edv.de (192.168.1.9) with esmtp ; Mon, 10 Jan 2011 10:40:02 +0100 From: Oliver Endriss To: linux-media@vger.kernel.org Cc: mchehab@redhat.com Subject: [PATCH 06/16] ngene: Clean-up driver initialisation (part 1) Date: Mon, 10 Jan 2011 10:36:14 +0100 Message-Id: <1294652184-12843-7-git-send-email-o.endriss@gmx.de> X-Mailer: git-send-email 1.6.5.3 In-Reply-To: <1294652184-12843-1-git-send-email-o.endriss@gmx.de> References: <1294652184-12843-1-git-send-email-o.endriss@gmx.de> X-Y-GMX-Trusted: 0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 10 Jan 2011 09:39:15 +0000 (UTC) diff --git a/drivers/media/dvb/ngene/ngene-cards.c b/drivers/media/dvb/ngene/ngene-cards.c index 5e6b85c..fc93d10 100644 --- a/drivers/media/dvb/ngene/ngene-cards.c +++ b/drivers/media/dvb/ngene/ngene-cards.c @@ -113,6 +113,7 @@ static int demod_attach_stv0900(struct ngene_channel *chan) 0, chan->dev->card_info->lnb[chan->number])) { printk(KERN_ERR DEVICE_NAME ": No LNBH24 found!\n"); dvb_frontend_detach(chan->fe); + chan->fe = NULL; return -ENODEV; } diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index 83fd74e..7ce8737 100644 --- a/drivers/media/dvb/ngene/ngene-core.c +++ b/drivers/media/dvb/ngene/ngene-core.c @@ -1481,23 +1481,32 @@ static int init_channel(struct ngene_channel *chan) if (io & NGENE_IO_TSIN) { chan->fe = NULL; - if (ni->demod_attach[nr]) - ni->demod_attach[nr](chan); + if (ni->demod_attach[nr]) { + ret = ni->demod_attach[nr](chan); + if (ret < 0) + goto err_fe; + } + if (chan->fe && ni->tuner_attach[nr]) { + ret = ni->tuner_attach[nr](chan); + if (ret < 0) + goto err_fe; + } if (chan->fe) { - if (dvb_register_frontend(adapter, chan->fe) < 0) { - if (chan->fe->ops.release) - chan->fe->ops.release(chan->fe); - chan->fe = NULL; - } + if (dvb_register_frontend(adapter, chan->fe) < 0) + goto err_fe; } - if (chan->fe && ni->tuner_attach[nr]) - if (ni->tuner_attach[nr] (chan) < 0) { - printk(KERN_ERR DEVICE_NAME - ": Tuner attach failed on channel %d!\n", - nr); - } } return ret; + +err_fe: + if (chan->fe) { + dvb_frontend_detach(chan->fe); + chan->fe = NULL; + } +/* FIXME: this causes an oops... */ +/* release_channel(chan); */ +/* return ret; */ + return 0; } static int init_channels(struct ngene *dev)