public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dvb-frontends/dvb-pll: fix module ref-counting
@ 2018-06-10 14:49 tskd08
  0 siblings, 0 replies; only message in thread
From: tskd08 @ 2018-06-10 14:49 UTC (permalink / raw)
  To: linux-media; +Cc: mchehab, Akihiro Tsukada

From: Akihiro Tsukada <tskd08@gmail.com>

dvb-pll module was 'put' twice on exit:
once by dvb_frontend_detach() and another by dvb_module_release().

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
---
 drivers/media/dvb-frontends/dvb-pll.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/media/dvb-frontends/dvb-pll.c b/drivers/media/dvb-frontends/dvb-pll.c
index e3894ff403d..4a663420190 100644
--- a/drivers/media/dvb-frontends/dvb-pll.c
+++ b/drivers/media/dvb-frontends/dvb-pll.c
@@ -884,6 +884,17 @@ dvb_pll_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	if (!dvb_pll_attach(fe, client->addr, client->adapter, desc_id))
 		return -ENOMEM;
 
+	/*
+	 * Unset tuner_ops.release (== dvb_pll_release)
+	 * which has been just set in the above dvb_pll_attach(),
+	 * because if tuner_ops.release was left defined,
+	 * this module would be 'put' twice on exit:
+	 * once by dvb_frontend_detach() and another by dvb_module_release().
+	 *
+	 * dvb_pll_release is instead executed in the i2c driver's .remove(),
+	 * keeping dvb_pll_attach untouched for legacy (dvb_attach) drivers.
+	 */
+	fe->ops.tuner_ops.release = NULL;
 	dev_info(&client->dev, "DVB Simple Tuner attached.\n");
 	return 0;
 }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-06-10 14:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-10 14:49 [PATCH] dvb-frontends/dvb-pll: fix module ref-counting tskd08

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox