linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pt3: fix DTV FE I2C driver load error paths
@ 2014-09-27  1:45 Antti Palosaari
  2014-09-28 10:28 ` Akihiro TSUKADA
  0 siblings, 1 reply; 2+ messages in thread
From: Antti Palosaari @ 2014-09-27  1:45 UTC (permalink / raw)
  To: linux-media
  Cc: Antti Palosaari, Mauro Carvalho Chehab, Akihiro Tsukada,
	Stephen Rothwell

Get rid of 'module_is_live' usage.

on x86_64:
when CONFIG_MODULES is not enabled:

../drivers/media/pci/pt3/pt3.c: In function 'pt3_attach_fe':
../drivers/media/pci/pt3/pt3.c:433:6: error: implicit declaration of function 'module_is_live' [-Werror=implicit-function-declaration]

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Akihiro Tsukada <tskd08@gmail.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
Maybe that is proper fix. I didn't test it.
---
 drivers/media/pci/pt3/pt3.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/media/pci/pt3/pt3.c b/drivers/media/pci/pt3/pt3.c
index 90f86ce..1fdeac1 100644
--- a/drivers/media/pci/pt3/pt3.c
+++ b/drivers/media/pci/pt3/pt3.c
@@ -393,7 +393,7 @@ static int pt3_attach_fe(struct pt3_board *pt3, int i)
 		return -ENODEV;
 	pt3->adaps[i]->i2c_demod = cl;
 	if (!try_module_get(cl->dev.driver->owner))
-		goto err_demod;
+		goto err_demod_i2c_unregister_device;
 
 	if (!strncmp(cl->name, TC90522_I2C_DEV_SAT, sizeof(cl->name))) {
 		struct qm1d1c0042_config tcfg;
@@ -415,28 +415,27 @@ static int pt3_attach_fe(struct pt3_board *pt3, int i)
 		cl = i2c_new_device(cfg.tuner_i2c, &info);
 	}
 	if (!cl || !cl->dev.driver)
-		goto err_demod;
+		goto err_demod_module_put;
 	pt3->adaps[i]->i2c_tuner = cl;
 	if (!try_module_get(cl->dev.driver->owner))
-		goto err_tuner;
+		goto err_tuner_i2c_unregister_device;
 
 	dvb_adap = &pt3->adaps[one_adapter ? 0 : i]->dvb_adap;
 	ret = dvb_register_frontend(dvb_adap, cfg.fe);
 	if (ret < 0)
-		goto err_tuner;
+		goto err_tuner_module_put;
 	pt3->adaps[i]->fe = cfg.fe;
 	return 0;
 
-err_tuner:
+err_tuner_module_put:
+	module_put(pt3->adaps[i]->i2c_tuner->dev.driver->owner);
+err_tuner_i2c_unregister_device:
 	i2c_unregister_device(pt3->adaps[i]->i2c_tuner);
-	if (pt3->adaps[i]->i2c_tuner->dev.driver->owner &&
-	    module_is_live(pt3->adaps[i]->i2c_tuner->dev.driver->owner))
-		module_put(pt3->adaps[i]->i2c_tuner->dev.driver->owner);
-err_demod:
+err_demod_module_put:
+	module_put(pt3->adaps[i]->i2c_demod->dev.driver->owner);
+err_demod_i2c_unregister_device:
 	i2c_unregister_device(pt3->adaps[i]->i2c_demod);
-	if (pt3->adaps[i]->i2c_demod->dev.driver->owner &&
-	    module_is_live(pt3->adaps[i]->i2c_demod->dev.driver->owner))
-		module_put(pt3->adaps[i]->i2c_demod->dev.driver->owner);
+
 	return ret;
 }
 
-- 
http://palosaari.fi/


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pt3: fix DTV FE I2C driver load error paths
  2014-09-27  1:45 [PATCH] pt3: fix DTV FE I2C driver load error paths Antti Palosaari
@ 2014-09-28 10:28 ` Akihiro TSUKADA
  0 siblings, 0 replies; 2+ messages in thread
From: Akihiro TSUKADA @ 2014-09-28 10:28 UTC (permalink / raw)
  To: Antti Palosaari, linux-media; +Cc: Mauro Carvalho Chehab, Stephen Rothwell

> Maybe that is proper fix. I didn't test it.

I had some tests with/without inserting a deliberate error return
from dvb_register_frontend() and with/without CONFIG_MODULES option,
and the all combinations seem to have worked fine.

kiitos, Antti and Randy.
--
akihiro

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-28 10:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-27  1:45 [PATCH] pt3: fix DTV FE I2C driver load error paths Antti Palosaari
2014-09-28 10:28 ` Akihiro TSUKADA

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).