[media] drxk: Fix driver removal
authorMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 10 Jul 2011 13:26:06 +0000 (10:26 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 27 Jul 2011 20:55:50 +0000 (17:55 -0300)
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/frontends/drxk_hard.c

index aaef8e35698bf185ec25f9c3ebe2eb3eac75e317..7ea73dfacdfbb18856f8133c9f6de870c2fa87b9 100644 (file)
@@ -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: