[PATCH 18/21] [media] drxk: Fix driver removal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>

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:
-- 
1.7.1


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux