From patchwork Mon Jul 11 01:59:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 963102 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6B20Nut010239 for ; Mon, 11 Jul 2011 02:00:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756822Ab1GKCAS (ORCPT ); Sun, 10 Jul 2011 22:00:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13354 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756664Ab1GKCAC (ORCPT ); Sun, 10 Jul 2011 22:00:02 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6B2028d018193 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 10 Jul 2011 22:00:02 -0400 Received: from pedra (vpn-225-29.phx2.redhat.com [10.3.225.29]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p6B1xKKh030664 for ; Sun, 10 Jul 2011 22:00:01 -0400 Date: Sun, 10 Jul 2011 22:59:03 -0300 From: Mauro Carvalho Chehab Cc: Linux Media Mailing List Subject: [PATCH 18/21] [media] drxk: Fix driver removal Message-ID: <20110710225903.2e34373b@pedra> In-Reply-To: References: Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 To: unlisted-recipients:; (no To-header on input) 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 (demeter2.kernel.org [140.211.167.43]); Mon, 11 Jul 2011 02:00:23 +0000 (UTC) Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c index aaef8e3..7ea73df 100644 --- a/drivers/media/dvb/frontends/drxk_hard.c +++ b/drivers/media/dvb/frontends/drxk_hard.c @@ -6431,6 +6431,18 @@ struct dvb_frontend *drxk_attach(const struct drxk_config *config, if (init_drxk(state) < 0) goto error; *fe_t = &state->t_frontend; + +#ifdef CONFIG_MEDIA_ATTACH + /* + * HACK: As this function initializes both DVB-T and DVB-C fe symbols, + * and calling it twice would create the state twice, leading into + * memory leaks, the right way is to call it only once. However, dvb + * release functions will call symbol_put twice. So, the solution is to + * artificially increment the usage count, in order to allow the + * driver to be released. + */ + symbol_get(drxk_attach); +#endif return &state->c_frontend; error: