From: Akihiro Tsukada Date: Sun, 10 Jun 2018 14:49:15 +0000 (-0400) Subject: media: dvb-frontends/dvb-pll: fix module ref-counting X-Git-Tag: v4.19-rc1~137^2~124 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=f917fc0e9b9988982a841b871655cc41bde1e10e;p=linux.git media: dvb-frontends/dvb-pll: fix module ref-counting dvb-pll module was 'put' twice on exit: once by dvb_frontend_detach() and another by dvb_module_release(). Signed-off-by: Akihiro Tsukada Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb-frontends/dvb-pll.c b/drivers/media/dvb-frontends/dvb-pll.c index e3894ff403d7..4a663420190e 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; }